Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Side by Side Diff: src/third_party/fdlibm/fdlibm.js

Issue 1084853002: Fix Math.log10 implementation for 1 - Number.EPSILON. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: preliminary fix for the test case Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/es6/math-log2-log10.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // The following is adapted from fdlibm (http://www.netlib.org/fdlibm), 1 // The following is adapted from fdlibm (http://www.netlib.org/fdlibm),
2 // 2 //
3 // ==================================================== 3 // ====================================================
4 // Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved. 4 // Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved.
5 // 5 //
6 // Developed at SunSoft, a Sun Microsystems, Inc. business. 6 // Developed at SunSoft, a Sun Microsystems, Inc. business.
7 // Permission to use, copy, modify, and distribute this 7 // Permission to use, copy, modify, and distribute this
8 // software is freely granted, provided that this notice 8 // software is freely granted, provided that this notice
9 // is preserved. 9 // is preserved.
10 // ==================================================== 10 // ====================================================
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 k -= 54; 879 k -= 54;
880 x *= TWO54; 880 x *= TWO54;
881 hx = %_DoubleHi(x); 881 hx = %_DoubleHi(x);
882 lx = %_DoubleLo(x); 882 lx = %_DoubleLo(x);
883 } 883 }
884 884
885 // Infinity or NaN. 885 // Infinity or NaN.
886 if (hx >= 0x7ff00000) return x; 886 if (hx >= 0x7ff00000) return x;
887 887
888 k += (hx >> 20) - 1023; 888 k += (hx >> 20) - 1023;
889 var i = (k & 0x80000000) >> 31; 889 var i = (k & 0x80000000) >>> 31;
890 hx = (hx & 0x000fffff) | ((0x3ff - i) << 20); 890 hx = (hx & 0x000fffff) | ((0x3ff - i) << 20);
891 var y = k + i; 891 var y = k + i;
892 x = %_ConstructDouble(hx, lx); 892 x = %_ConstructDouble(hx, lx);
893 893
894 var z = y * LOG10_2LO + IVLN10 * %_MathLogRT(x); 894 var z = y * LOG10_2LO + IVLN10 * %_MathLogRT(x);
895 return z + y * LOG10_2HI; 895 return z + y * LOG10_2HI;
896 } 896 }
897 897
898 898
899 // ES6 draft 09-27-13, section 20.2.2.22. 899 // ES6 draft 09-27-13, section 20.2.2.22.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 "log10", MathLog10, 1021 "log10", MathLog10,
1022 "log2", MathLog2, 1022 "log2", MathLog2,
1023 "log1p", MathLog1p, 1023 "log1p", MathLog1p,
1024 "expm1", MathExpm1 1024 "expm1", MathExpm1
1025 ]); 1025 ]);
1026 1026
1027 %SetInlineBuiltinFlag(MathSin); 1027 %SetInlineBuiltinFlag(MathSin);
1028 %SetInlineBuiltinFlag(MathCos); 1028 %SetInlineBuiltinFlag(MathCos);
1029 1029
1030 })(); 1030 })();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es6/math-log2-log10.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698