How Matlab computes trigonometric functions?
Mostrar comentarios más antiguos
When I learned the CORDIC algorithm, I had a question to Matlab.
How Matlab computes trigonometric function?
for e.g. in case of cosd(27)
1. Does answer evaluate by Taylor series using floating point computation or by Look Up Table from Taylor?
If both are not, what algorithm is used for computation?
2. If it uses Taylor series, what is the last order of Taylor series? (Just N that satisfies fractional bit of floating point?)
3. What is the accuracy of trigonometric function?
(I want to know whether Matlab gives 52(53) bit fractional accuracy using (some) nearest rounding in double precision value)
1 comentario
dpb
el 26 de Nov. de 2016
In general, TMW doesn't comment on such internals but for library functions such as this, I'd expect Matlab simply relies on the underlying compiler standard libraries rather than reinventing the wheel...
Respuesta aceptada
Más respuestas (2)
Steven Lord
el 27 de Nov. de 2016
1 voto
Walter Roberson
el 26 de Nov. de 2016
0 votos
cosd() checks for some special cases, and if it is not one of the special cases then it transforms to radians and invokes cos()
cos() uses the underlying hardware instructions.
You might be interested in the discussion at https://members.loria.fr/PZimmermann/papers/decimalexp.pdf which gives some reasons why it is difficult to round such functions correctly.
Categorías
Más información sobre Trigonometry en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!