ES3.1 Proposal Working Draft

Brendan Eich brendan at
Thu Feb 21 01:36:52 PST 2008

On Feb 20, 2008, at 1:25 PM, Mark S. Miller wrote:

> What numbers are representable as double but not decimal?

Mike Cowlishaw's page at is  
extremely informative, especially 
decifaq.html; see also the link to

See and for  
double to decimal conversion answers. As 
doku.php?id=proposals:decimal summarizes:

* A very small amount of precision which may be present in a double- 
precision binary fp number is lost during a double → decimal  
promotion, but that:
     o No precision is lost in an integral → decimal promotion.
     o Reading a numeric lexeme as a decimal preserves more precision  
than reading it as a double.

> Does decimal have NaN, Infinity, -Infinity,

Yes -- from the ES4 RI:

   >> -1.0m/0.0m
   >> 1.0m/0.0m
   >> 0.0m/0.0m

> and -0.0?


 >> 1.0m/-0.0m

> (Btw, I never liked -0.0. And I especially dislike ES3's
> behavior that 0.0 === -0.0. However, I would argue against making
> incompatible changes to this.)

Guy Steele edited Edition 1 of ECMA-262 and argued for both of these  
parts of the standard, based on precedent in related programming  
languages, as well as advice in IEEE-754 itself. He pointed out  
something important to numerical programmers: you can walk around the  
four quadrants using signed zeros with atan2:

js> Math.atan2(0,0)
js> Math.atan2(-0,0)
js> Math.atan2(-0,-0)
js> Math.atan2(0,-0)


More information about the Es4-discuss mailing list