summaryrefslogtreecommitdiff
path: root/node_modules/locutus/php/math/expm1.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/locutus/php/math/expm1.js')
-rw-r--r--node_modules/locutus/php/math/expm1.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/node_modules/locutus/php/math/expm1.js b/node_modules/locutus/php/math/expm1.js
new file mode 100644
index 0000000..9943362
--- /dev/null
+++ b/node_modules/locutus/php/math/expm1.js
@@ -0,0 +1,13 @@
+"use strict";
+
+module.exports = function expm1(x) {
+ // discuss at: http://locutus.io/php/expm1/
+ // original by: Brett Zamir (http://brett-zamir.me)
+ // improved by: Robert Eisele (http://www.xarg.org/)
+ // note 1: Precision 'n' can be adjusted as desired
+ // example 1: expm1(1e-15)
+ // returns 1: 1.0000000000000007e-15
+
+ return x < 1e-5 && x > -1e-5 ? x + 0.5 * x * x : Math.exp(x) - 1;
+};
+//# sourceMappingURL=expm1.js.map \ No newline at end of file