opensubscriber
   Find in this group all groups
 
Unknown more information…

g : glasgow-haskell-users@haskell.org 12 July 2012 • 12:05AM -0400

Re: How to describe this bug?
by Tyson Whitehead

REPLY TO AUTHOR
 
REPLY TO GROUP




On July 11, 2012 04:51:50 Christian Maeder wrote:
> Is it not enough to store floats into memory just before equality tests
> (or add rounding in the instance definitions of Float and Double in Eq
> and Ord)?

You have to be 100% consistent in how you do every operations in all cases
otherwise different levels of rounding errors will creep into the results.

It isn't too hard to imagine a floating point expression getting inlined
somewhere, and the compiler generating code to evalulate it all in registers.  
Intermediate operations will then be done to 80 bit precision.

Elsewhere, it doesn't get inlined and the compiler generates code to store
intermediate results in memory.  Intermediate operations will then be done to
32 bit precision.  Different results will occur on the rounding boundaires.

Always storing and reloading after every operations will give you consistent
results.  I guess the other option is to disable inlining etc. or somehow
ensure they are applied consistently in all use cases of an expression.

Cheers!  -Tyson

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@hask...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.