[Strawman proposal] StrictMath variant of Math

Isiah Meadows impinball at gmail.com
Thu Jul 31 17:16:44 PDT 2014

I was looking at the number of complaints about the Math object, especially
regarding the lack of required precision (refer to the thread "Re: ES6
accuracy of special functions" for a lengthy discussion on this). Because
of this, I propose that a new object, StrictMath, should be added. This
would be analogous to java.lang.Math (performance) vs java.util.StrictMath
(accuracy). People could still define their own implementations if needed,

Basic specs would be similar to the Math object, but with the following

1. Fixed-size integer methods such as Math.imul() don't need a StrictMath
2. The input precision must be no more than a Float64 in size (depends on
how this is spec'd, may not be necessary).
3. The output should have an error no greater than 1 ulp (the space between
two adjacent, distinct floating point values, identical to the Java spec of
an ulp).

I don't see #2 staying if this is spec'd well, but the rest remain. Java's
java.lang.StrictMath actually requires the fdlibm semantics and algorithm
to be used for that class's implementations. java.lang.Math is closer to
this spec in its own specification.

Isiah Meadows
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140731/6db96fcd/attachment.html>

More information about the es-discuss mailing list