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

Unified Diff: src/math.js

Issue 457643002: Implement Math.log1p using port from fdlibm. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: changed test Created 6 years, 4 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/bootstrapper.cc ('k') | test/mjsunit/es6/math-log1p.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/math.js
diff --git a/src/math.js b/src/math.js
index 436a41f5c44400609fe7cc446f318ca36ca6aacd..9cf4f1c9bdbb6561431d8c7dc267149311ac5ad3 100644
--- a/src/math.js
+++ b/src/math.js
@@ -347,26 +347,6 @@ function MathExpm1(x) {
}
}
-// ES6 draft 09-27-13, section 20.2.2.20.
-// Use Taylor series to approximate. With y = x + 1;
-// log(y) at 1 == log(1) + log'(1)(y-1)/1! + log''(1)(y-1)^2/2! + ...
-// == 0 + x - x^2/2 + x^3/3 ...
-// The closer x is to 0, the fewer terms are required.
-function MathLog1p(x) {
- if (!IS_NUMBER(x)) x = NonNumberToNumber(x);
- var xabs = MathAbs(x);
- if (xabs < 1E-7) {
- return x * (1 - x * (1/2));
- } else if (xabs < 3E-5) {
- return x * (1 - x * (1/2 - x * (1/3)));
- } else if (xabs < 7E-3) {
- return x * (1 - x * (1/2 - x * (1/3 - x * (1/4 -
- x * (1/5 - x * (1/6 - x * (1/7)))))));
- } else { // Use regular log if not close enough to 0.
- return MathLog(1 + x);
- }
-}
-
// -------------------------------------------------------------------
function SetUpMath() {
@@ -428,7 +408,7 @@ function SetUpMath() {
"fround", MathFroundJS,
"clz32", MathClz32,
"cbrt", MathCbrt,
- "log1p", MathLog1p,
+ "log1p", MathLog1p, // implemented by third_party/fdlibm
"expm1", MathExpm1
));
« no previous file with comments | « src/bootstrapper.cc ('k') | test/mjsunit/es6/math-log1p.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698