You can find plenty of discussion on this issue at
https://code.google.com/p/v8/issues/detail?id=3006.

Note that 64-bit doubles have 15-16 decimal digits of precision, so you
have (best case):
-3.16836290305272216816234731596E-1
 <--significant--><---random--->

The new implementation trades a bit of precision for much more speed. Since
the JS specification does not make any guarantees about precision, this is
not a bug. That said, there's some hope that we'll find a better
speed/precision compromise in the future.


On Wed, Feb 26, 2014 at 10:22 PM, Erik Neumann <[email protected]>wrote:

> I should add that on my system, running the same test under Safari and
> Firefox is still returning the correct result of 0xBFD4470BB84303C9.  Only
> Chrome is failing.
>  --ErikN
>
> On Wed, Feb 26, 2014 at 1:11 PM, Erik Neumann <[email protected]> wrote:
>
>> In Chrome Version 33.0.1750.117 the Math.cos() function is returning
>> different and less accurate results.
>>
>> Specifically Math.cos(-1.89318839074561684476805112354) should be
>> -3.16836290305272216816234731596E-1 but is now returning
>> -3.16836290305271717215873650275E-1 instead.
>>
>> This has changed since early February with Chrome version 32.0.1700.102.
>>
>> I am running on Mac OS X 10.9.1 with 16 GB of memory.
>>
>> Some more details:  The double hex values involved are:
>> angle = 0xBFFE4A7FE8F6B56D = -1.89318839074561684476805112354
>> According to mathematica (or Wolfram Alpha) the result should be:
>> -0.31683629030527219006269881180
>> The nearest double hex value is 0xBFD4470BB84303C9 =
>> -3.16836290305272216816234731596E-1
>> And that is the result I was previously getting in Chrome version 32.
>>
>> But we are getting now:
>>
>> 0xBFD4470BB84303C0 = -3.16836290305271717215873650275E-1
>>
>> This is significantly different, and is a problem for my application.
>>
>
>
>  --
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to