Thoughts on IEEE P754
brendan at mozilla.org
Sat Aug 23 18:49:07 PDT 2008
On Aug 23, 2008, at 2:07 AM, Maciej Stachowiak wrote:
> To my view, Decimal is much less important overall than, say,
> ByteArray or some other effective way to represent binary data, which
> is not in ES3.1 and was even rejected from ES4 (at least as then
Just for the record, ByteArray was cut in favor of Vector.<byte>,
which yielded to Vector.<int> with the loss of byte, which yielded
with the loss of int (wait for it ;-)) to the return of ByteVector
(cuts were being made to the troublesome machine integer types, but a
byte-vector type was part of the plan all along). Parameterized types
were ultimately not required; we were back to a nominal type
ByteVector that could be used without new syntax. See
Anyway, I agree ByteArray or ByteVector is important. I wouldn't put
it in a lifeboat-ethics contest with Decimal (one of the two must be
tossed over) for ES-Harmony, but for ES3.1 there is no contest.
So I agree that Decimal is out of scope for ES3.1, and I've said so
often, most recently in Oslo. But the hardball being played to get
*and* let it into ES3.1 has been an obstacle to frank exchange of
opinions among all of the committee members. IMHO.
> There's a lot more popular Web applications that would be
> interested in manipulating binary data efficiently than care about
> calculating prices.
The ones that calculate prices apparently use pennies and round
carefully when multiplying by things like sales tax rates.
> Finally, while Decimal seems like it will be useful to knowledgeable
> developers dealing with financial data, it seems likely to confuse the
> average developer more than it will help.
That is unclear. A "use decimal" pragma that does not allow implicit
conversions from binary64 to decimal128 might work well for most
users; they'd never notice the lack of speed or the greater
precision, and they would definitely like the powers-of-five
expressiveness (https://bugzilla.mozilla.org/show_bug.cgi?id=5856 is
still seeing duplicate reports; bloggers are still blaming one
company or another for "math being broken" in JS). But there are too
many variables to be sure of what would work.
I wrote recently that the best way to get Decimal done is to
implement it as an extension, with operators, I hope with a safe "use
decimal" pragma, in popular open source browsers. Then and only then
might we get some kind of usability feedback. We desperately need
experiments, not guesses or committee prescriptions.
Pushing a de jure spec first, or at the same time as prototype
implementations, and on a short deadline (next spring), risks making
ES3.1 late (again), or -- if the spec makes it by next spring in
advance of usability feedback -- risks premature standardization
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Es-discuss