On Sep 24, 2008, at 9:18 AM, Sam Ruby wrote:
[over-top-citing trimmed]
The concern remains, though. Not due to power-of-five problems that
would lead to 0.09999999999999987 or the like, but from cases where a
number was spelled with extra trailing zeros (in external data,
e.g. a
spreadsheet) but fits in an integer, or otherwise can be expressed
exactly using powers of two. The burden of proof here is on the
invariant breaker :-/.
I fully appreciate the need for a high bar here.
Sure, so maybe that bar height is why people talk about "broken".
It's a presumption of "guilt", alien to Anglo-Saxon jurisprudence.
The Napoleonic ECMAScript code prevails here. Beware! :-P.
The problem here is that there are two invariants. === to a high
degree
of accuracy today is an eq operator. But people have argued
against 1.2
!== 1.20, because of another invariant:
a == b && typeof(a) === typeof(b) implies a === b
We can't satisfy both.
I do not think === is eq -- it's hard to argue degree when kind is
the issue, as others have pointed out. Any hashcode addition would
want eq, or force people to invent it at tedious and ineffecient length.
Past posts here have mixed up cohort and -0 vs. 0, but we've been
educated thanks to MFC. Really, === breaks down on NaN and the
zeroes, and there's no way to rationalize it as eq. I noted how Guy
Steele helped us get past one broken equality operator, in order to
add === and !== in ES1, and we talked about eq then. It still looms
in the future, Harmony or (some argue) 3.1.
My initial preference was that 1.2 !== 1.20, but
as we are not aware of code that uses fractional indexes, but are
aware
of code that does generic typeof and equality testing, I would think
that the latter would have a higher weight.
Ignoring === as faux eq, the only issue here is d.toString() for
decimal d: should it preserve scale and stringify trailing zeroes and
funny exponents?
/be
/be
- Sam Ruby
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss