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

Unified Diff: src/js/math.js

Issue 2068743002: [builtins] Unify Atanh, Cbrt and Expm1 as exports from flibm. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed type warning. Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/external-reference-table.cc ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/math.js
diff --git a/src/js/math.js b/src/js/math.js
index abb1251e3de113e831cdcd4b0efd511d4633c17f..e8fccd224bacb7ae1b38455cf7cdbe6c8eede198 100644
--- a/src/js/math.js
+++ b/src/js/math.js
@@ -88,16 +88,6 @@ function MathAcosh(x) {
return %math_log(x + %math_sqrt(x + 1) * %math_sqrt(x - 1));
}
-// ES6 draft 09-27-13, section 20.2.2.7.
-function MathAtanh(x) {
- x = TO_NUMBER(x);
- // Idempotent for +/-0.
- if (x === 0) return x;
- // Returns NaN for NaN and +/- Infinity.
- if (!NUMBER_IS_FINITE(x)) return NaN;
- return 0.5 * %math_log((1 + x) / (1 - x));
-}
-
// ES6 draft 09-27-13, section 20.2.2.17.
function MathHypot(x, y) { // Function length is 2.
// We may want to introduce fast paths for two arguments and when
@@ -127,29 +117,6 @@ function MathHypot(x, y) { // Function length is 2.
return %math_sqrt(sum) * max;
}
-// ES6 draft 09-27-13, section 20.2.2.9.
-// Cube root approximation, refer to: http://metamerist.com/cbrt/cbrt.htm
-// Using initial approximation adapted from Kahan's cbrt and 4 iterations
-// of Newton's method.
-function MathCbrt(x) {
- x = TO_NUMBER(x);
- if (x == 0 || !NUMBER_IS_FINITE(x)) return x;
- return x >= 0 ? CubeRoot(x) : -CubeRoot(-x);
-}
-
-macro NEWTON_ITERATION_CBRT(x, approx)
- (1.0 / 3.0) * (x / (approx * approx) + 2 * approx);
-endmacro
-
-function CubeRoot(x) {
- var approx_hi = %math_floor(%_DoubleHi(x) / 3) + 0x2A9F7893;
- var approx = %_ConstructDouble(approx_hi | 0, 0);
- approx = NEWTON_ITERATION_CBRT(x, approx);
- approx = NEWTON_ITERATION_CBRT(x, approx);
- approx = NEWTON_ITERATION_CBRT(x, approx);
- return NEWTON_ITERATION_CBRT(x, approx);
-}
-
// -------------------------------------------------------------------
%InstallToContext([
@@ -183,9 +150,7 @@ utils.InstallFunctions(GlobalMath, DONT_ENUM, [
"sign", MathSign,
"asinh", MathAsinh,
"acosh", MathAcosh,
- "atanh", MathAtanh,
"hypot", MathHypot,
- "cbrt", MathCbrt
]);
%SetForceInlineFlag(MathAbs);
« no previous file with comments | « src/external-reference-table.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698