Updates:
        Status: WorkingAsIntended

Comment #1 on issue 1974 by [email protected]: Re: Issue 115790 in chromium: JavaScript issue. Result different from expected
http://code.google.com/p/v8/issues/detail?id=1974

I think this is working as intended. Double values cannot be expected to be 100% accurate if their exact representation would require more mantissa bits than are available. If you compute the (in theory) same double in two different ways, like Math.pow() will do internally if you give it two different sets of arguments, you cannot rely on the result to be exactly the same: depending on the sequence of internally performed operations, the rounding errors that both results necessarily contain can be a little different.

Workarounds:
- use an arbitrary-precision Integer representation for your numbers (JavaScript provides none, you'd have to implement it yourself) - in this particular case, you could avoid the explicit calculation of the products altogether, and represent each number as its sorted list of prime factors instead - or the easiest solution: account for slight rounding errors by changing your counting condition to the following:

if (i == 0 || r[i]/r[i-1] > 1 + 1e-14) count++;


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to