ES6 accuracy of special functions

Carl Shapiro carl.shapiro at
Tue Jul 29 13:37:48 PDT 2014

The exp function in V8 has a similar issue

as do the recently added hyperbolics

These issues are not limited to the V8 environment.  As noted in the
spreadsheet, other browsers exhibit similar behaviour.

Having relaxed constraints on the trigonometric functions can put a
substantial burden on the user.  Writing and testing an application becomes
more time consuming and error prone.  Using JS as a portable assembler for
numeric applications requires additional care because the special functions
deviate in their behaviour from the C library.  Authoring an efficient and
accurate implementation of the special functions generally requires access
to low-level primitives not available in JS making it impossible to code
around accuracy limitations portability and efficiently.

On Tue, Jul 29, 2014 at 5:50 AM, alawatthe <alawatthe at> wrote:

> Clear rules would also help in discussions like this one:
> Background:
> V8 implemented a new version of sin and cos, which is faster, but does not
> have the precision many user want.
> One of the comments (#8) said about precision:
> - The ECMA script specification clearly states that Math.sin/cos are implementation-dependent approximations. There is no guarantees required regarding precision.
> I think, this feels a little bit odd, because where do we draw the line between performance and precision?
> So, again clear rules (even if they are not as strict as in Java), would help a lot.
> All the best
> alex aka alawatthe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list