Thoughts on IEEE P754
Mark S. Miller
erights at google.com
Fri Aug 22 14:46:36 PDT 2008
On Fri, Aug 22, 2008 at 11:39 AM, Waldemar Horwat <waldemar at google.com> wrote:
> Sam Ruby wrote:
>> When dealing with currency, having 0.05 + 0.05 produce 0.10 is a feature.
> Contrary to some beliefs, the different cohort members in IEEE P754 are *not* a valid indicator of precision. To prove this, assume that the different cohort members are an indicator of precision. Then evaluate:
> 3.00 + 1.00000
> IEEE P754 returns 4.00000, while the result is actually precise to only two digits after the decimal point. Hence a contradiction. QED.
This example makes me realize how utterly confused and ignorant I am
about the rationale for decimal.
In particular, on one of the ES3.1 calls, Sam explained why he thought
mixed mode arithmetic should convert to binary -- IIUC, in order to
faithfully represent our ignorance of the precision that should be
associated with the result. From what I thought I'd understood, I
would have expected the above example to produce 4.00. However, the
above example makes clear that decimal by itself, even when non-mixed,
does not attempt to accurately (or conservatively) represent one's
ignorance of precision.
Sam, did I get your rationale wrong? Now that we've seen these
examples from Waldemar, could you try explaining again why mixed
should result in binary?
Finally, I'd like to take a poll: Other than people working on decimal
at IBM and people on the EcmaScript committee, is there anyone on this
list who thinks that decimal adds significant value to EcmaScript? If
so, please speak up. Thanks.
More information about the Es-discuss