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

  • $\begingroup$ I don't understand a think in the range reduction... why is always referred to the trigonometric functions and not for other functions. I've seen an analysis referred to additive range reduction in the muller book, but i have never seen something related to the multiplicative range reduction. looks like the other functions are not of interest for the error analysis. Is it my impressions? $\endgroup$ – user8469759 Jun 16 '15 at 10:25
  • $\begingroup$ 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 \%$. $\endgroup$ – gammatester Jun 16 '15 at 10:31
  • $\begingroup$ But i mean... as you said it applies to all periodic function... what i was wandering (just out of curiosity) if there's anything related to log and exp for example, about how much a poor range reduction could influence the final result. $\endgroup$ – user8469759 Jun 16 '15 at 10:35
  • $\begingroup$ 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. $\endgroup$ – gammatester Jun 16 '15 at 10:50
  • $\begingroup$ That's a good point... why i need increased precisions? it's the same question for the trig functions... $\endgroup$ – user8469759 Jun 16 '15 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.