How Matlab computes trigonometric functions?
Afficher commentaires plus anciens
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 commentaire
dpb
le 26 Nov 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...
Réponse acceptée
Plus de réponses (2)
Steven Lord
le 27 Nov 2016
1 vote
Walter Roberson
le 26 Nov 2016
0 votes
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.
Catégories
En savoir plus sur Trigonometry dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!