OLD | NEW |
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 Loading... |
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 Loading... |
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 })(); |
OLD | NEW |