Thoughts on IEEE P754

Waldemar Horwat waldemar at
Fri Aug 22 11:39:57 PDT 2008

Sam Ruby wrote:
>> - We should not print the trailing zeroes.  IEEE P754 does not
>> require it, and it breaks things such as array lookup.  There is
>> precedence for this in ECMAScript:  -0 and +0 both print as "0".  If
>> someone really wants to distinguish among equal numbers, he can do it
>> with a function call to one of the mandated functions.
> Please explain the breakage?

It's already explained in the other emails here.

> 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.

It gets worse.  If you insist on distinguishing cohort members while printing then you'll really confuse users who print the result of:


Hint:  The result is equal to 10 but could not print as "10".  Scroll down to see the actual value that distinguishing cohort members would require to be printed.

Answer:  Were we to distinguish cohort members, that value of 10 would be required to print as "1e1".  This is unacceptable and, as mentioned before, breaks array indexing.


More information about the Es-discuss mailing list