Boost logo

Boost :

From: Rozental, Gennadiy (gennadiy.rozental_at_[hidden])
Date: 2003-07-07 13:22:22


> Let t be tmp and e? be error values (smaller than ulp/2).
>
> rounded(rounded(t*t) - t)
> = ((t*t) * (1+e1) - t) * (1+e2)
> = t*t - t + t*t * (e1+e2+e1*e2) - t*e2
>
> So how much is the relative error? For example, if e1=ulp/2
> and e2=0, the absolute error reaches t*t*ulp/2 = 0.605*ulp.
> So the relative error is 0.605*ulp / (11/100) = 5.5*ulp. The
> result may be 6 ulps away! (and maybe
> more)

You seems to be right. My test program produces relative errors up to
2e+7*ulp.
 
> Thinking rounding errors just add themselves is a
> misunderstanding of floating-point arithmetic (if it was that
> easy, interval arithmetic wouldn't be useful).
>
> Guillaume

I could probably prohibit usage of CHECK_CLOSE with number of rounding
errors provided.
Is there any other general recommendations how to choose the tolerance to FP
computation correctness checking?

Gennadiy.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk