How Matlab computes trigonometric functions?
古いコメントを表示
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 件のコメント
dpb
2016 年 11 月 26 日
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...
採用された回答
その他の回答 (2 件)
Steven Lord
2016 年 11 月 27 日
1 投票
Walter Roberson
2016 年 11 月 26 日
0 投票
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.
カテゴリ
ヘルプ センター および File Exchange で Trigonometry についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!