| 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 12 matching lines...) Expand all Loading... |
| 23 // rempio2result is used as a container for return values of %RemPiO2. It is | 23 // rempio2result is used as a container for return values of %RemPiO2. It is |
| 24 // initialized to a two-element Float64Array during genesis. | 24 // initialized to a two-element Float64Array during genesis. |
| 25 | 25 |
| 26 var kMath; | 26 var kMath; |
| 27 var rempio2result; | 27 var rempio2result; |
| 28 | 28 |
| 29 (function() { | 29 (function() { |
| 30 | 30 |
| 31 "use strict"; | 31 "use strict"; |
| 32 | 32 |
| 33 %CheckIsBootstrapping(); |
| 34 |
| 35 var GlobalMath = global.Math; |
| 36 var GlobalArray = global.Array; |
| 37 |
| 38 //------------------------------------------------------------------- |
| 39 |
| 33 const INVPIO2 = kMath[0]; | 40 const INVPIO2 = kMath[0]; |
| 34 const PIO2_1 = kMath[1]; | 41 const PIO2_1 = kMath[1]; |
| 35 const PIO2_1T = kMath[2]; | 42 const PIO2_1T = kMath[2]; |
| 36 const PIO2_2 = kMath[3]; | 43 const PIO2_2 = kMath[3]; |
| 37 const PIO2_2T = kMath[4]; | 44 const PIO2_2T = kMath[4]; |
| 38 const PIO2_3 = kMath[5]; | 45 const PIO2_3 = kMath[5]; |
| 39 const PIO2_3T = kMath[6]; | 46 const PIO2_3T = kMath[6]; |
| 40 const PIO4 = kMath[32]; | 47 const PIO4 = kMath[32]; |
| 41 const PIO4LO = kMath[33]; | 48 const PIO4LO = kMath[33]; |
| 42 | 49 |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 var t = n; | 1006 var t = n; |
| 1000 var t1 = %_ConstructDouble(%_DoubleHi(((z_h + z_l) + dp_h) + t), 0); | 1007 var t1 = %_ConstructDouble(%_DoubleHi(((z_h + z_l) + dp_h) + t), 0); |
| 1001 var t2 = z_l - (((t1 - t) - dp_h) - z_h); | 1008 var t2 = z_l - (((t1 - t) - dp_h) - z_h); |
| 1002 | 1009 |
| 1003 // t1 + t2 = log2(ax), sum up because we do not care about extra precision. | 1010 // t1 + t2 = log2(ax), sum up because we do not care about extra precision. |
| 1004 return t1 + t2; | 1011 return t1 + t2; |
| 1005 } | 1012 } |
| 1006 | 1013 |
| 1007 //------------------------------------------------------------------- | 1014 //------------------------------------------------------------------- |
| 1008 | 1015 |
| 1009 %CheckIsBootstrapping(); | 1016 InstallFunctions(GlobalMath, DONT_ENUM, GlobalArray( |
| 1010 | |
| 1011 InstallFunctions(global.Math, DONT_ENUM, $Array( | |
| 1012 "cos", MathCos, | 1017 "cos", MathCos, |
| 1013 "sin", MathSin, | 1018 "sin", MathSin, |
| 1014 "tan", MathTan, | 1019 "tan", MathTan, |
| 1015 "sinh", MathSinh, | 1020 "sinh", MathSinh, |
| 1016 "cosh", MathCosh, | 1021 "cosh", MathCosh, |
| 1017 "log10", MathLog10, | 1022 "log10", MathLog10, |
| 1018 "log2", MathLog2, | 1023 "log2", MathLog2, |
| 1019 "log1p", MathLog1p, | 1024 "log1p", MathLog1p, |
| 1020 "expm1", MathExpm1 | 1025 "expm1", MathExpm1 |
| 1021 )); | 1026 )); |
| 1022 | 1027 |
| 1023 %SetInlineBuiltinFlag(MathSin); | 1028 %SetInlineBuiltinFlag(MathSin); |
| 1024 %SetInlineBuiltinFlag(MathCos); | 1029 %SetInlineBuiltinFlag(MathCos); |
| 1025 | 1030 |
| 1026 })(); | 1031 })(); |
| OLD | NEW |