ES Decimal Status

liorean liorean at gmail.com
Wed Sep 24 08:58:47 PDT 2008


> Maciej wrote:
> "I'm not sure what you are getting at. a[1] and a[1.000] refer to the
> same property in ECMAScript, but a[1m] and a[1.000m] would not. Are
> you saying this isn't a problem?"

I would say this is indeed a problem. I'm of the opinion that
decimal128 and binary64 should behave identically in as many areas as
possible, and that since cohorts are strictly equal to each other,
roundtripping does not need to preserve scale, only cohort. Breaking
the stringification equality of strictly equal numbers in one
representation is a much bigger issue than roundtripping preserving
scale. A .toScaleString or something like it should be added for the
case of needing a roundtrip where the scale is preserved.

2008/9/24 Michael <Michael at lanex.com>:
> This is not quite true as you can see here:
>
> var a = [];
> a[1] = "foo";
> a[1.00] = "bar";
>
> WScript.Echo("length: "+a.length + "\n["+ a.join()+"]")
> --------------------------------------------
> length: 2
> [,bar]

And the length property has exactly nothing to do with what has been
discussed here.
-- 
David "liorean" Andersson


More information about the Es-discuss mailing list