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

Side by Side Diff: src/math.js

Issue 88053002: Implement Math.ceil via Math.floor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/runtime.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 // ECMA 262 - 15.8.2.5 68 // ECMA 262 - 15.8.2.5
69 // The naming of y and x matches the spec, as does the order in which 69 // The naming of y and x matches the spec, as does the order in which
70 // ToNumber (valueOf) is called. 70 // ToNumber (valueOf) is called.
71 function MathAtan2(y, x) { 71 function MathAtan2(y, x) {
72 return %Math_atan2(TO_NUMBER_INLINE(y), TO_NUMBER_INLINE(x)); 72 return %Math_atan2(TO_NUMBER_INLINE(y), TO_NUMBER_INLINE(x));
73 } 73 }
74 74
75 // ECMA 262 - 15.8.2.6 75 // ECMA 262 - 15.8.2.6
76 function MathCeil(x) { 76 function MathCeil(x) {
77 return %Math_ceil(TO_NUMBER_INLINE(x)); 77 return -MathFloor(-x);
78 } 78 }
79 79
80 // ECMA 262 - 15.8.2.7 80 // ECMA 262 - 15.8.2.7
81 function MathCos(x) { 81 function MathCos(x) {
82 x = MathAbs(x); // Convert to number and get rid of -0. 82 x = MathAbs(x); // Convert to number and get rid of -0.
83 return TrigonometricInterpolation(x, 1); 83 return TrigonometricInterpolation(x, 1);
84 } 84 }
85 85
86 // ECMA 262 - 15.8.2.8 86 // ECMA 262 - 15.8.2.8
87 function MathExp(x) { 87 function MathExp(x) {
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 "sin", MathSin, 341 "sin", MathSin,
342 "sqrt", MathSqrt, 342 "sqrt", MathSqrt,
343 "tan", MathTan, 343 "tan", MathTan,
344 "atan2", MathAtan2, 344 "atan2", MathAtan2,
345 "pow", MathPow, 345 "pow", MathPow,
346 "max", MathMax, 346 "max", MathMax,
347 "min", MathMin, 347 "min", MathMin,
348 "imul", MathImul 348 "imul", MathImul
349 )); 349 ));
350 350
351 %SetInlineBuiltinFlag(MathCeil);
351 %SetInlineBuiltinFlag(MathRandom); 352 %SetInlineBuiltinFlag(MathRandom);
352 %SetInlineBuiltinFlag(MathSin); 353 %SetInlineBuiltinFlag(MathSin);
353 %SetInlineBuiltinFlag(MathCos); 354 %SetInlineBuiltinFlag(MathCos);
354 %SetInlineBuiltinFlag(MathTan); 355 %SetInlineBuiltinFlag(MathTan);
355 %SetInlineBuiltinFlag(TrigonometricInterpolation); 356 %SetInlineBuiltinFlag(TrigonometricInterpolation);
356 } 357 }
357 358
358 SetUpMath(); 359 SetUpMath();
OLDNEW
« no previous file with comments | « no previous file | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698