Es-discuss - several decimal discussions
waldemar at google.com
Mon Aug 25 16:00:55 PDT 2008
Brendan Eich wrote:
>> In any case, is there any general agreement about *whether* 1.0m ==
>> 1.00m or 1.0m === 1.00m? This is where I lost track.
> Yes, I believe Sam and I agree on those holding true. As you note,
> typeof x == typeof y && x == y => x === y, so anything else will
> break that relation, and it's not just an ideal form: users,
> especially those taught to avoid == in favor of ===, will have our
> heads if 1.0m != 1.00m.
As I wrote earlier, having 1.0m === 1.00m is the only sensible choice. If you don't then you'll get total weirdness such as:
1e12m - 1e12m !== 0m
More information about the Es-discuss