The JSC implementation of Number.toPrecision sometimes gets a different last digit on intel Macs than on PowerPC Macs or non-Mac intel systems. This is most likely due to a bug in the system pow() function. Nevertheless, I have a patch that works around it by directly coding computation of integer powers of 10.
Created attachment 7040 [details] fix by adding intPow10 function I only replaced toPrecision's use of pow(10.0, n) with intPow10(n). Should I do the same for toExponential and toFixed (even though we have not yet spotted a specific bug with those)? I am guessing they will face the same problem with pow()'s bad rounding of powers of 10.
Comment on attachment 7040 [details] fix by adding intPow10 function - e = static_cast<int>(log10(x)); + e = static_cast<int>(trunc(log10(x))); Why that change? Does trunc add value? Why trunc and not floor? + n = floor(x / tens); Looks like there's a tab in the patch. r=me
Finally landed this.