My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 21: S15.8.2.16_A7 may be bogus
6 people starred this issue and may be notified of changes. Back to list
Status:  Accepted
Owner:  christia...@gmail.com


Sign in to add a comment
 
Reported by jason.or...@gmail.com, Mar 12, 2010
SpiderMonkey fails this test on Ubuntu Linux x86:

===
15_Native_ECMA_Script_Objects/15.8_The_Math_Object/15.8.2_Function_Properties_of_the_Math_Object/15.8.2.16_sin/S15.8.2.16_A7
failed ===
--- errors ---
uncaught exception: SputnikError:
x = 6.283185307179586
libc.sin(x) = -2.4492935982947064e-16
Math.sin(x) = -2.4492127076447545e-16
Math.abs(libc.sin(x) - Math.sin(x)) > 1.9721522630525295e-31

Two questions:

1. I think x is the floating-point number closest to 2pi. I'm not a IEEE
floating-point expert, but shouldn't 0 be an acceptable answer?

2. We're just calling libc sin() here, which I think is what the other
JavaScript implementations do too. Does anyone pass this test on Linux x86?

The path we execute in glibc's sin() implementation basically just loads x
into an FPU register and executes the FSIN instruction.

Mar 15, 2010
#1 ja...@hoppipolla.co.uk
The spec is rather clear that the accuracy of the trig functions (and many of the 
other mathematical functions) is implementation specific except for certain special 
values. Therefore, given the remit of Sputnik, it seems these tests should be removed 
(I don't disagree that testing for accuracy of these funcions is a useful thing to do, 
but it is explicitly not a conformance issue).
Mar 16, 2010
Project Member #2 christia...@gmail.com
Good point.  While I think it is unhealthy for implementations to deviate from each 
other it's true that the spec doesn't back this test up.  So it should be dropped.

Status: Accepted
Owner: christian.plesner.hansen
Apr 8, 2011
#3 Spoonful...@gmail.com
Reducing the precision is also (imho) viable:

    return(2 * Math.pow(2, -16 + pernum));
Sign in to add a comment

Powered by Google Project Hosting