I'm trying to find an implementation of a multiple precision version of the sin functions. I'm trying to read through the mpfr library (the C/C++ source code) but I can't find any code related to the actual implementation.
What I basically want to know is how the argument reduction is performed in such case (multiple precision), It's probably possible that a huge LUT is stored to represent the inverse of pi
, that would allow to handle all possible cases (with cases I mean the mantissa size).
Could you point me out what specific source to look at? The code is quite complicated to read through.
The range reduction is not implemented with a huge LUT: this is not possible because the exponent range is too large. What is done is just to compute pi with sufficient accuracy; the value of pi is cached for the next calls to the trigonometric functions, and pi is recomputed each time more accuracy is needed.
You can get information by looking at the source of MPFR and/or by building
algorithms.pdf
from thedoc
directory with LaTeX. But this document may not be always up-to-date and some information may be missing.