How can I know the algorithm that MATLAB uses to approximate values of the sine function?

2 views (last 30 days)
Hi, I try to understand and study the algorithms that MATLAB uses to evaluate sin(x). Since sin(.) is a built-in function, in general, I cannot access the source code. Would that be possible to find that source code somewhere else? Thank you

Accepted Answer

Steven Lord
Steven Lord on 25 Jul 2016
Take a look at this Cleve's Corner article from Feb. 2002.
If you wanted to see the built-in source code for sin, the first step is to go here.

More Answers (1)

John D'Errico
John D'Errico on 25 Jul 2016
Cleve's article is a good one. It discusses range reduction, a tremendously valuable method for special function evaluation. exp, sin, cos, all benefit from that. There are also methods I discuss in the documentation for HPF, where I explain how to get hundreds or thousands of digits for these problems. There are also tricks one can use to minimize the number of divides, useful in environments where a divide costs more time than a multiply.
Another great source of ideas can be found in Hart's book, "Computer Approximations", a superb text that may be difficult to find anymore. And of course, Abramowitz & Stegun is the classic reference for virtually anything in this domain.

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!