How do computers calculate sine?
androidcalculator.com
How do computers calculate sine?
1–10 of 167 posts
Re: How do computers calculate sine?
#2sine is easy because the series is globally convergent and fast converging
Re: How do computers calculate sine?
#31 - cos^2(x), obviously
Re: How do computers calculate sine?
#4sine is easy because the series is globally convergent and fast converging
Did you read the article? It is specifically about how the series looks simple, but the error is actually very bad if you do things naively.
Re: How do computers calculate sine?
#5Link doesn't appear to be valid, but aren't these usually precalculated and stored in a lookup table?
Re: How do computers calculate sine?
#6I've seen the third order Taylor series used, but with the coefficients calculated at various offsets for a quarter wave. So you lookuo where you are in the quarter wave, then look up the 3 or 4 cofficients. This keeps the error somewhat bounded as the size of X is a small so the series does not diverge too much.
Re: How do computers calculate sine?
#7And arcsin?
Re: How do computers calculate sine?
#8http://steve.hollasch.net/cgindex/math/inccos.html is a great technique if you need a fast integer approximation for some some arbitrary sampling interval (i.e. motor control)
Re: How do computers calculate sine?
#9sine is easy because the series is globally convergent and fast converging
Did you read the article? It is specifically about how the series looks simple, but the error is actually very bad if you do things naively.
That still makes it easier compared to computing constants in which the series are not globally convergent, like inverse trig functions. Obviously, you would have to break it apart to speed convergence.
Re: How do computers calculate sine?
#10This made me realize that trigonometric functions are not deterministic across different CPU architectures, OS, and programming languages (floating point precision aside).
E.g. I would assume that Math.sin(x) returns the same thing in NodeJS on Windows and Mac/M1, but it turns out it is necessarily so. https://stackoverflow.com/questions/74074312/standard-math-f...