From: cilibrar@... (Rudi Cilibrasi) Date: 2003-04-19T23:57:34+09:00 Subject: Re: Roundoff problem with Float and Marshal I followed up with Guy on this, and it seems that my original test script (on a single machine) passes fine on a Sun, which means that the patch is working for big-endian and little-endian seperately. Apparently sometimes it makes a mistake when comparing big-endian and little-endian results. I wonder, however, what causes it? I can imagine one possibilities: 1) Math.exp, or some simpler floating-point operation, is behaving differently on the two platforms, but only by a small amount. In other words, the "true" value of many operations is somewhere inbetween two different actually representable doubles, and the FPU has to arbitrarily decide which one to choose. I believe the IEEE754 standard specifies a tolerance that allows several different answers to be compliant, so long as the results of the operations are reasonably close to the correct value. I am wondering if there is any general way to fix this? I tend to think this is beyond the scope of Ruby; we cannot guarantee that floating-point programs running on different architectures that are started with the same state will continue to evolve in the same way, because there is always the chance for different round-off choices. I think it is ok if we can simply guarantee that moving a floating-point number across the network or through a file will not change its value so long as the architecture remains consistent, and also that the value will not change much if the architecture changes. I believe this is still the behavior that is observed with this patch. Rudi