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

Side by Side Diff: src/harmony-math.js

Issue 358423003: Implement the `Math.TAU` constant. Base URL: git@github.com:v8/v8.git@master
Patch Set: Created 6 years, 5 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/harmony/math-tau.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 // 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 x * (1/5 - x * (1/6 - x * (1/7))))))); 214 x * (1/5 - x * (1/6 - x * (1/7)))))));
215 } else { // Use regular log if not close enough to 0. 215 } else { // Use regular log if not close enough to 0.
216 return MathLog(1 + x); 216 return MathLog(1 + x);
217 } 217 }
218 } 218 }
219 219
220 220
221 function ExtendMath() { 221 function ExtendMath() {
222 %CheckIsBootstrapping(); 222 %CheckIsBootstrapping();
223 223
224 // Set up math constants.
225 InstallConstants($Math, $Array(
226 "TAU", 6.283185307179586
227 ));
228
224 // Set up the non-enumerable functions on the Math object. 229 // Set up the non-enumerable functions on the Math object.
225 InstallFunctions($Math, DONT_ENUM, $Array( 230 InstallFunctions($Math, DONT_ENUM, $Array(
226 "sign", MathSign, 231 "sign", MathSign,
227 "trunc", MathTrunc, 232 "trunc", MathTrunc,
228 "sinh", MathSinh, 233 "sinh", MathSinh,
229 "cosh", MathCosh, 234 "cosh", MathCosh,
230 "tanh", MathTanh, 235 "tanh", MathTanh,
231 "asinh", MathAsinh, 236 "asinh", MathAsinh,
232 "acosh", MathAcosh, 237 "acosh", MathAcosh,
233 "atanh", MathAtanh, 238 "atanh", MathAtanh,
234 "log10", MathLog10, 239 "log10", MathLog10,
235 "log2", MathLog2, 240 "log2", MathLog2,
236 "hypot", MathHypot, 241 "hypot", MathHypot,
237 "fround", MathFroundJS, 242 "fround", MathFroundJS,
238 "clz32", MathClz32, 243 "clz32", MathClz32,
239 "cbrt", MathCbrt, 244 "cbrt", MathCbrt,
240 "log1p", MathLog1p, 245 "log1p", MathLog1p,
241 "expm1", MathExpm1 246 "expm1", MathExpm1
242 )); 247 ));
243 } 248 }
244 249
245 250
246 ExtendMath(); 251 ExtendMath();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/math-tau.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698