> 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.
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to