OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 var preliminary = sum + summand; | 149 var preliminary = sum + summand; |
150 compensation = (preliminary - sum) - summand; | 150 compensation = (preliminary - sum) - summand; |
151 sum = preliminary; | 151 sum = preliminary; |
152 } | 152 } |
153 return MathSqrt(sum) * max; | 153 return MathSqrt(sum) * max; |
154 } | 154 } |
155 | 155 |
156 | 156 |
157 // ES6 draft 09-27-13, section 20.2.2.16. | 157 // ES6 draft 09-27-13, section 20.2.2.16. |
158 function MathFround(x) { | 158 function MathFround(x) { |
159 return %MathFround(TO_NUMBER_INLINE(x)); | 159 return %Math_fround(TO_NUMBER_INLINE(x)); |
160 } | 160 } |
161 | 161 |
162 | 162 |
163 function MathClz32(x) { | 163 function MathClz32(x) { |
164 x = ToUint32(TO_NUMBER_INLINE(x)); | 164 x = ToUint32(TO_NUMBER_INLINE(x)); |
165 if (x == 0) return 32; | 165 if (x == 0) return 32; |
166 var result = 0; | 166 var result = 0; |
167 // Binary search. | 167 // Binary search. |
168 if ((x & 0xFFFF0000) === 0) { x <<= 16; result += 16; }; | 168 if ((x & 0xFFFF0000) === 0) { x <<= 16; result += 16; }; |
169 if ((x & 0xFF000000) === 0) { x <<= 8; result += 8; }; | 169 if ((x & 0xFF000000) === 0) { x <<= 8; result += 8; }; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 "fround", MathFround, | 260 "fround", MathFround, |
261 "clz32", MathClz32, | 261 "clz32", MathClz32, |
262 "cbrt", MathCbrt, | 262 "cbrt", MathCbrt, |
263 "log1p", MathLog1p, | 263 "log1p", MathLog1p, |
264 "expm1", MathExpm1 | 264 "expm1", MathExpm1 |
265 )); | 265 )); |
266 } | 266 } |
267 | 267 |
268 | 268 |
269 ExtendMath(); | 269 ExtendMath(); |
OLD | NEW |