use decimal

Maciej Stachowiak mjs at apple.com
Thu Sep 18 21:10:36 PDT 2008


On Sep 18, 2008, at 6:03 PM, Mark S. Miller wrote:

> On Thu, Sep 18, 2008 at 5:22 PM, Maciej Stachowiak <mjs at apple.com>  
> wrote:
>
> On Sep 18, 2008, at 5:13 PM, Mark S. Miller wrote:
>
>> On Thu, Sep 18, 2008 at 4:52 PM, Brendan Eich <brendan at mozilla.org>  
>> wrote:
>> -0 and 0 are not the same "given floating point number". 1/-0 vs.  
>> 1/0 and Math.atan2(-0,0) vs. 0,0 are but two examples.
>>
>> Yes, I understand their operational difference. Whether that  
>> difference means they are not the same number depends on how you  
>> define "number". I would have defined "representing the same  
>> number" by correspondence to the reals. YMMV.
>
> But the mathematical behavior of floating point numbers is not the  
> same as that of the reals. Not just because of -0. See <http://docs.sun.com/source/806-3568/ncg_goldberg.html 
> >
>
> Floating point numbers are a useful rough approximation of the reals  
> for many practical calculations, but treating them as if they were  
> in fact a subset of the reals is not mathematically sound.
>
>
> Long long ago I actually had read that document carefully, and I had  
> also looked at I think the [Brown 1981] which it cites. (But the doc  
> has no bibliography. Anyone have a pointer?) My memory of the theory  
> of floating point is that the numbers are exact but the operations  
> are approximate.

I'm not sure what it means for values to be "exact" representations of  
real numbers when operations on them break even the most fundamental  
identities of real arithmetic. For many values of A, B and C, (A + B)  
+ C != A + (B + C). And with the right values, it's not just a tiny  
difference of units in the last place, these expressions can be wildly  
different in value.

The bottom line to me is, if you are very very careful, then floating  
point numbers might be a useful approximate model of the real numbers  
for a given problem, but fundamentally their behavior is very  
different from the reals and they should not be considered to truly  
map to any subset of R.

Regards,
Maciej

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/es-discuss/attachments/20080918/43ef4d0d/attachment.html 


More information about the Es-discuss mailing list