# error bound in function approximation algorithm

Suppose we have the set of floating point number with "m" bit mantissa and "e" bits for exponent. Suppose more over we want to approximate a function "f".

From the theory we know that usually a "range reduced function" is used and then from such function we derive the global function value.

For example let x = (sx,ex,mx) (sign exp and mantissa) then... log2(x) = ex + log2(1.mx) so basically the range reduced function is "log2(1.mx)".

I have implemented at present reciprocal, square root, log2 and exp2, recently i've started to work with the trigonometric functions. But i was wandering if given a global error bound (ulp error especially) it is possible to derive an error bound for the range reduced function, is there some study about this kind of problem? Speaking of the log2(x) (as example) i would lke to be able to say...

"ok i want log2(x) with k ulp error, to achieve this given our floating point system we need to approximate log2(1.mx) with p ulp error"

Remember that as i said we know we are working with floating point number, but the format is generic, so it could be the classic F32, but even for example e=10, m = 8 end so on.

I can't actually find any reference that shows such kind of study. Reference i have (i.e. muller book) doesn't treat the topic in this way so i was looking for some kind of paper or similar. Do you know any reference?

I'm also trying to derive such bound by myself but it is not easy...

Since $\sin, \cos$ are periodic and bounded for real arguments, your error depends mainly on the range reduction $\pmod {2\pi}$ or $\pmod {\pi/2}.$ This is tricky because you must know all the $2^e + O(1)$ bits of $2/\pi$ to get a reliable result. For trigonmetric redution you can use the so-called Payne/Hanek reduction, see e.g. K.C. Ng, Argument Reduction for Huge Arguments: Good to the Last Bit, Technical report, SunPro, 1992, available from http://www.validlab.com/arg.pdf
• This is not restricted to trigonometric functions, but applies to all periodic function with irrational or transcendental period (e.g. elliptic integrals etc). Simply speaking: If you do not have a reliable range reduction you will leave most or all phase information and the absolute error can be $\pm 100 \%$. – gammatester Jun 16 '15 at 10:31
• An example: Looking at $\exp(x)$ in binary arithmetic you should know some constant like $\log_2(e)$ with increased precision (and perform some pseudo multi precision operations, Cody/Waite in Muller's book) since you compute $2^{i+f}$ where $i,f$ are integer and fractional part of $x \log_2(e).$ Here the errors in the fractional part are directly related to the error in the mantissa of the result, if there is no increased precision the number of bits that go into the integer part will be lost for the fractional part. – gammatester Jun 16 '15 at 10:50