| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 // ES6 draft 09-27-13, section 20.2.2.28. | 7 // ES6 draft 09-27-13, section 20.2.2.28. |
| 8 function MathSign(x) { | 8 function MathSign(x) { |
| 9 x = TO_NUMBER_INLINE(x); | 9 x = TO_NUMBER_INLINE(x); |
| 10 if (x > 0) return 1; | 10 if (x > 0) return 1; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 var summand = n * n - compensation; | 125 var summand = n * n - compensation; |
| 126 var preliminary = sum + summand; | 126 var preliminary = sum + summand; |
| 127 compensation = (preliminary - sum) - summand; | 127 compensation = (preliminary - sum) - summand; |
| 128 sum = preliminary; | 128 sum = preliminary; |
| 129 } | 129 } |
| 130 return MathSqrt(sum) * max; | 130 return MathSqrt(sum) * max; |
| 131 } | 131 } |
| 132 | 132 |
| 133 | 133 |
| 134 // ES6 draft 09-27-13, section 20.2.2.16. | 134 // ES6 draft 09-27-13, section 20.2.2.16. |
| 135 function MathFround(x) { | 135 function MathFroundJS(x) { |
| 136 return %MathFround(TO_NUMBER_INLINE(x)); | 136 return %MathFround(TO_NUMBER_INLINE(x)); |
| 137 } | 137 } |
| 138 | 138 |
| 139 | 139 |
| 140 function MathClz32(x) { | 140 function MathClz32(x) { |
| 141 x = ToUint32(TO_NUMBER_INLINE(x)); | 141 x = ToUint32(TO_NUMBER_INLINE(x)); |
| 142 if (x == 0) return 32; | 142 if (x == 0) return 32; |
| 143 var result = 0; | 143 var result = 0; |
| 144 // Binary search. | 144 // Binary search. |
| 145 if ((x & 0xFFFF0000) === 0) { x <<= 16; result += 16; }; | 145 if ((x & 0xFFFF0000) === 0) { x <<= 16; result += 16; }; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 "trunc", MathTrunc, | 227 "trunc", MathTrunc, |
| 228 "sinh", MathSinh, | 228 "sinh", MathSinh, |
| 229 "cosh", MathCosh, | 229 "cosh", MathCosh, |
| 230 "tanh", MathTanh, | 230 "tanh", MathTanh, |
| 231 "asinh", MathAsinh, | 231 "asinh", MathAsinh, |
| 232 "acosh", MathAcosh, | 232 "acosh", MathAcosh, |
| 233 "atanh", MathAtanh, | 233 "atanh", MathAtanh, |
| 234 "log10", MathLog10, | 234 "log10", MathLog10, |
| 235 "log2", MathLog2, | 235 "log2", MathLog2, |
| 236 "hypot", MathHypot, | 236 "hypot", MathHypot, |
| 237 "fround", MathFround, | 237 "fround", MathFroundJS, |
| 238 "clz32", MathClz32, | 238 "clz32", MathClz32, |
| 239 "cbrt", MathCbrt, | 239 "cbrt", MathCbrt, |
| 240 "log1p", MathLog1p, | 240 "log1p", MathLog1p, |
| 241 "expm1", MathExpm1 | 241 "expm1", MathExpm1 |
| 242 )); | 242 )); |
| 243 } | 243 } |
| 244 | 244 |
| 245 | 245 |
| 246 ExtendMath(); | 246 ExtendMath(); |
| OLD | NEW |