On 2012-02-05 20:52:39 +0000, Dave Korn wrote: > On 05/02/2012 19:01, Vincent Lefevre wrote: > > On 2012-02-04 13:00:45 +0100, Andreas Schwab wrote: > >> But it is indistinguishable from 10^22+pi. So both -0.8522008497671888 > >> and 0.8522008497671888 are correct results, or anything inbetween. > > > > No, 10^22 and 10^22+pi are different numbers. > > Only one of which can be represented in floating point. > > So, the gist of the argument is that FP numbers do not represent ranges; > they are a precise but sparse representation of the number line. > > It's still not a lot of use doing trig up at the top end of the FP range > where 1 ulp > 2pi. The odds of the value that you wanted to represent > actually being representable are tiny, and hence so are the odds of getting > anything like the result you were hoping for. But, at least identities should > work.
Yes, but one point I'd like to make is that one may want to specify a portable result, as for instance, one may want to perform computations on a heterogeneous network of machines. Even on a single machine, there may be different algorithms/implementations to evaluate some function (e.g., compile time vs runtime, and grouped evaluations such as with a sincos function if both sin and cos are evaluated on the same argument). And correct rounding is the only good specification if one wants a portable result. -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <http://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)