ES6 accuracy of special functions

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


The exp function in V8 has a similar issue

https://code.google.com/p/v8/issues/detail?id=3468

as do the recently added hyperbolics

https://code.google.com/p/v8/issues/detail?id=3266

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 googlemail.com> wrote:

> Clear rules would also help in discussions like this one:
> https://code.google.com/p/v8/issues/detail?id=3006
>
> 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: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140729/b3f14602/attachment.html>


More information about the es-discuss mailing list