Commit 2c01bd34 authored by yangguo's avatar yangguo Committed by Commit bot

Fix Math.log10 implementation for 1 - Number.EPSILON.

R=svenpanne@chromium.org
BUG=v8:4025
LOG=N

Review URL: https://codereview.chromium.org/1084853002

Cr-Commit-Position: refs/heads/master@{#27815}
parent 835eeafe
......@@ -886,7 +886,7 @@ function MathLog10(x) {
if (hx >= 0x7ff00000) return x;
k += (hx >> 20) - 1023;
var i = (k & 0x80000000) >> 31;
var i = (k & 0x80000000) >>> 31;
hx = (hx & 0x000fffff) | ((0x3ff - i) << 20);
var y = k + i;
x = %_ConstructDouble(hx, lx);
......
......@@ -50,6 +50,9 @@ for (var i = -310; i <= 308; i += 0.5) {
// Test denormals.
assertEquals(-307.77759430519706, Math.log10(1.5 * Math.pow(2, -1023)));
// Issue 4025. Remove delta once issue 4029 has been fixed.
assertEqualsDelta(-9.643274665532873e-17, Math.log10(1-Number.EPSILON), 3e-32);
// Test Math.log2(2^k) for -1074 <= k <= 1023.
var n = -1074;
// This loop covers n from -1074 to -1043
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment