Out-of-range decimal literals

Mike Cowlishaw MFC at uk.ibm.com
Thu Sep 18 10:36:10 PDT 2008


> > Languages have "personalities", and people build up expectations based
> > on these characteristics.  As much as possible, I'd like to suggest
> > that ECMAScript be internally consistent, and not have one independent
> > choice (binary vs decimal) have unexpected implications over another
> > (signaling vs quiet operations).
> 
> The decimal literals introduces a new feature, a type suffix for a
> number, to explicitly specify the type of the literal. It may well be
> possible that this is not the last suffix to be added to ES. If, for
> example, there would be a suffix to denote 32 bit int, it would be
> very strange to allow to write 5000000000i. Another possibility is
> support for exact binary floating point literals. Here again rounding
> out-of-range literals would look strange as the programmer would
> bother to write the number on purpose to get exact presentation.

For exact binary floating point literals there probably isn't a problem as 
one would presumably use the hexadecimal format in IEEE 754 (the same as 
in C) -- and it's fairly clearly an error if too may bits are specified 
for the significand.  However, I suppose longer significands could be 
allowed and rounded -- although that is very much against the concept of 
exact literals.

Mike





Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU








More information about the Es-discuss mailing list