Socket
Socket
Sign inDemoInstall

complex.js

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

complex.js - npm Package Compare versions

Comparing version 2.0.10 to 2.0.11

2

bower.json
{
"name": "complex.js",
"main": "complex.js",
"version": "2.0.10",
"version": "2.0.11",
"homepage": "https://github.com/infusion/Complex.js",

@@ -6,0 +6,0 @@ "description": "A complex number library",

/**
* @license Complex.js v2.0.10 11/02/2016
* @license Complex.js v2.0.11 11/02/2016
*

@@ -320,3 +320,3 @@ * Copyright (c) 2016, Robert Eisele (robert@xarg.org)

// Infinity + Infinity = NaN
if (this.isInfinite() && z.isInfinite()) {
if (this['isInfinite']() && z['isInfinite']()) {
return Complex['NAN'];

@@ -326,3 +326,3 @@ }

// Infinity + z = Infinity { where z != Infinity }
if (this.isInfinite() || z.isInfinite()) {
if (this['isInfinite']() || z['isInfinite']()) {
return Complex['INFINITY'];

@@ -346,3 +346,3 @@ }

// Infinity - Infinity = NaN
if (this.isInfinite() && z.isInfinite()) {
if (this['isInfinite']() && z['isInfinite']()) {
return Complex['NAN'];

@@ -352,3 +352,3 @@ }

// Infinity - z = Infinity { where z != Infinity }
if (this.isInfinite() || z.isInfinite()) {
if (this['isInfinite']() || z['isInfinite']()) {
return Complex['INFINITY'];

@@ -372,3 +372,3 @@ }

// Infinity * 0 = NaN
if ((this.isInfinite() && z.isZero()) || (this.isZero() && z.isInfinite())) {
if ((this['isInfinite']() && z['isZero']()) || (this['isZero']() && z['isInfinite']())) {
return Complex['NAN'];

@@ -378,3 +378,3 @@ }

// Infinity * z = Infinity { where z != 0 }
if (this.isInfinite() || z.isInfinite()) {
if (this['isInfinite']() || z['isInfinite']()) {
return Complex['INFINITY'];

@@ -403,3 +403,3 @@ }

// 0 / 0 = NaN and Infinity / Infinity = NaN
if ((this.isZero() && z.isZero()) || (this.isInfinite() && z.isInfinite())) {
if ((this['isZero']() && z['isZero']()) || (this['isInfinite']() && z['isInfinite']())) {
return Complex['NAN'];

@@ -409,3 +409,3 @@ }

// Infinity / 0 = Infinity
if (this.isInfinite() || z.isZero()) {
if (this['isInfinite']() || z['isZero']()) {
return Complex['INFINITY'];

@@ -415,3 +415,3 @@ }

// 0 / Infinity = 0
if (this.isZero() || z.isInfinite()) {
if (this['isZero']() || z['isInfinite']()) {
return Complex['ZERO'];

@@ -464,3 +464,3 @@ }

if (z.isZero()) {
if (z['isZero']()) {
return Complex['ONE'];

@@ -1152,3 +1152,3 @@ }

if (this.isZero()) {
if (this['isZero']()) {
return Complex['INFINITY'];

@@ -1175,7 +1175,7 @@ }

// 1 / 0 = Infinity and 1 / Infinity = 0
if (this.isZero()) {
if (this['isZero']()) {
return Complex['INFINITY'];
}
if (this.isInfinite()) {
if (this['isInfinite']()) {
return Complex['ZERO'];

@@ -1290,11 +1290,11 @@ }

if (this.isNaN()) {
if (this['isNaN']()) {
return 'NaN';
}
if (this.isZero()) {
if (this['isZero']()) {
return '0';
}
if (this.isInfinite()) {
if (this['isInfinite']()) {
return 'Infinity';

@@ -1391,3 +1391,3 @@ }

'isInfinite': function() {
return !(this.isNaN() || this.isFinite());
return !(this['isNaN']() || this['isFinite']());
}

@@ -1394,0 +1394,0 @@ };

/*
Complex.js v2.0.10 11/02/2016
Complex.js v2.0.11 11/02/2016
Copyright (c) 2016, Robert Eisele (robert@xarg.org)
Dual licensed under the MIT or GPL Version 2 licenses.
Copyright (c) 2016, Robert Eisele (robert@xarg.org)
Dual licensed under the MIT or GPL Version 2 licenses.
*/

@@ -10,15 +10,16 @@ (function(n){function h(){throw SyntaxError("Invalid Param");}function g(a){return.5*(Math.exp(a)-Math.exp(-a))}function e(a){return.5*(Math.exp(a)+Math.exp(-a))}function m(a,b){var c=Math.abs(a),d=Math.abs(b);return 0===a?Math.log(d):0===b?Math.log(c):3E3>c&&3E3>d?.5*Math.log(a*a+b*b):Math.log(a/Math.cos(Math.atan2(b,a)))}function d(a,b){if(!(this instanceof d))return new d(a,b);var c={re:0,im:0};if(void 0===a||null===a)c.re=c.im=0;else if(void 0!==b)c.re=a,c.im=b;else switch(typeof a){case "object":"im"in

k&&"\n"!==k&&("+"===k?l++:"-"===k?e++:("i"===k||"I"===k?(0===l+e&&h()," "===f[g+1]||isNaN(f[g+1])?c.im+=parseFloat((e%2?"-":"")+"1"):(c.im+=parseFloat((e%2?"-":"")+f[g+1]),g++)):((0===l+e||isNaN(k))&&h(),"i"===f[g+1]||"I"===f[g+1]?(c.im+=parseFloat((e%2?"-":"")+k),g++):c.re+=parseFloat((e%2?"-":"")+k)),l=e=0))}0<l+e&&h();break;case "number":c.im=0;c.re=a;break;default:h()}this.re=c.re;this.im=c.im}d.prototype={re:0,im:0,sign:function(){var a=this.abs();return new d(this.re/a,this.im/a)},add:function(a,
b){var c=new d(a,b);return this.a()&&c.a()?d.NAN:this.a()||c.a()?d.INFINITY:new d(this.re+c.re,this.im+c.im)},sub:function(a,b){var c=new d(a,b);return this.a()&&c.a()?d.NAN:this.a()||c.a()?d.INFINITY:new d(this.re-c.re,this.im-c.im)},mul:function(a,b){var c=new d(a,b);return this.a()&&c.b()||this.b()&&c.a()?d.NAN:this.a()||c.a()?d.INFINITY:0===c.im&&0===this.im?new d(this.re*c.re,0):new d(this.re*c.re-this.im*c.im,this.re*c.im+this.im*c.re)},div:function(a,b){var c=new d(a,b);if(this.b()&&c.b()||
this.a()&&c.a())return d.NAN;if(this.a()||c.b())return d.INFINITY;if(this.b()||c.a())return d.ZERO;a=this.re;b=this.im;var f=c.re,e=c.im;if(0===e)return new d(a/f,b/f);if(Math.abs(f)<Math.abs(e))return c=f/e,f=f*c+e,new d((a*c+b)/f,(b*c-a)/f);c=e/f;f=e*c+f;return new d((a+b*c)/f,(b-a*c)/f)},pow:function(a,b){var c=new d(a,b);a=this.re;b=this.im;if(c.b())return d.ONE;if(0===c.im){if(0===b&&0<=a)return new d(Math.pow(a,c.re),0);if(0===a)switch((c.re%4+4)%4){case 0:return new d(Math.pow(b,c.re),0);case 1:return new d(0,
Math.pow(b,c.re));case 2:return new d(-Math.pow(b,c.re),0);case 3:return new d(0,-Math.pow(b,c.re))}}if(0===a&&0===b&&0<c.re&&0<=c.im)return d.ZERO;var f=Math.atan2(b,a),e=m(a,b);a=Math.exp(c.re*e-c.im*f);b=c.im*e+c.re*f;return new d(a*Math.cos(b),a*Math.sin(b))},sqrt:function(){var a=this.re,b=this.im,c=this.abs();if(0<=a){if(0===b)return new d(Math.sqrt(a),0);var f=.5*Math.sqrt(2*(c+a))}else f=Math.abs(b)/Math.sqrt(2*(c-a));a=0>=a?.5*Math.sqrt(2*(c-a)):Math.abs(b)/Math.sqrt(2*(c+a));return new d(f,
0>b?-a:a)},exp:function(){var a=Math.exp(this.re);return new d(a*Math.cos(this.im),a*Math.sin(this.im))},expm1:function(){var a=this.re,b=this.im;var c=Math.PI/4;b<-c||b>c?c=Math.cos(b)-1:(c=b*b,c*=-.5+c*(1/24+c*(-1/720+c*(1/40320+c*(-1/3628800+c*(1/4790014600+c*(-1/87178291200+1/20922789888E3*c)))))));return new d(Math.expm1(a)*Math.cos(b)+c,Math.exp(a)*Math.sin(b))},log:function(){var a=this.re,b=this.im;return new d(m(a,b),Math.atan2(b,a))},abs:function(){var a=this.re;var b=this.im,c=Math.abs(a),
d=Math.abs(b);3E3>c&&3E3>d?a=Math.sqrt(c*c+d*d):(c<d?(c=d,d=a/b):d=b/a,a=c*Math.sqrt(1+d*d));return a},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var a=this.re,b=this.im;return new d(Math.sin(a)*e(b),Math.cos(a)*g(b))},cos:function(){var a=this.re,b=this.im;return new d(Math.cos(a)*e(b),-Math.sin(a)*g(b))},tan:function(){var a=2*this.re,b=2*this.im,c=Math.cos(a)+e(b);return new d(Math.sin(a)/c,g(b)/c)},cot:function(){var a=2*this.re,b=2*this.im,c=Math.cos(a)-e(b);return new d(-Math.sin(a)/
c,g(b)/c)},sec:function(){var a=this.re,b=this.im,c=.5*e(2*b)+.5*Math.cos(2*a);return new d(Math.cos(a)*e(b)/c,Math.sin(a)*g(b)/c)},csc:function(){var a=this.re,b=this.im,c=.5*e(2*b)-.5*Math.cos(2*a);return new d(Math.sin(a)*e(b)/c,-Math.cos(a)*g(b)/c)},asin:function(){var a=this.re,b=this.im,c=(new d(b*b-a*a+1,-2*a*b)).sqrt();a=(new d(c.re-b,c.im+a)).log();return new d(a.im,-a.re)},acos:function(){var a=this.re,b=this.im,c=(new d(b*b-a*a+1,-2*a*b)).sqrt();a=(new d(c.re-b,c.im+a)).log();return new d(Math.PI/
2-a.im,a.re)},atan:function(){var a=this.re,b=this.im;if(0===a){if(1===b)return new d(0,Infinity);if(-1===b)return new d(0,-Infinity)}var c=a*a+(1-b)*(1-b);a=(new d((1-b*b-a*a)/c,-2*a/c)).log();return new d(-.5*a.im,.5*a.re)},acot:function(){var a=this.re,b=this.im;if(0===b)return new d(Math.atan2(1,a),0);var c=a*a+b*b;return 0!==c?(new d(a/c,-b/c)).atan():(new d(0!==a?a/0:0,0!==b?-b/0:0)).atan()},asec:function(){var a=this.re,b=this.im;if(0===a&&0===b)return new d(0,Infinity);var c=a*a+b*b;return 0!==
c?(new d(a/c,-b/c)).acos():(new d(0!==a?a/0:0,0!==b?-b/0:0)).acos()},acsc:function(){var a=this.re,b=this.im;if(0===a&&0===b)return new d(Math.PI/2,Infinity);var c=a*a+b*b;return 0!==c?(new d(a/c,-b/c)).asin():(new d(0!==a?a/0:0,0!==b?-b/0:0)).asin()},sinh:function(){var a=this.re,b=this.im;return new d(g(a)*Math.cos(b),e(a)*Math.sin(b))},cosh:function(){var a=this.re,b=this.im;return new d(e(a)*Math.cos(b),g(a)*Math.sin(b))},tanh:function(){var a=2*this.re,b=2*this.im,c=e(a)+Math.cos(b);return new d(g(a)/
c,Math.sin(b)/c)},coth:function(){var a=2*this.re,b=2*this.im,c=e(a)-Math.cos(b);return new d(g(a)/c,-Math.sin(b)/c)},csch:function(){var a=this.re,b=this.im,c=Math.cos(2*b)-e(2*a);return new d(-2*g(a)*Math.cos(b)/c,2*e(a)*Math.sin(b)/c)},sech:function(){var a=this.re,b=this.im,c=Math.cos(2*b)+e(2*a);return new d(2*e(a)*Math.cos(b)/c,-2*g(a)*Math.sin(b)/c)},asinh:function(){var a=this.im;this.im=-this.re;this.re=a;var b=this.asin();this.re=-this.im;this.im=a;a=b.re;b.re=-b.im;b.im=a;return b},acosh:function(){var a=
this.acos();if(0>=a.im){var b=a.re;a.re=-a.im;a.im=b}else b=a.im,a.im=-a.re,a.re=b;return a},atanh:function(){var a=this.re,b=this.im,c=1<a&&0===b,e=1-a,g=1+a,h=e*e+b*b;a=0!==h?new d((g*e-b*b)/h,(b*e+g*b)/h):new d(-1!==a?a/0:0,0!==b?b/0:0);b=a.re;a.re=m(a.re,a.im)/2;a.im=Math.atan2(a.im,b)/2;c&&(a.im=-a.im);return a},acoth:function(){var a=this.re,b=this.im;if(0===a&&0===b)return new d(0,Math.PI/2);var c=a*a+b*b;return 0!==c?(new d(a/c,-b/c)).atanh():(new d(0!==a?a/0:0,0!==b?-b/0:0)).atanh()},acsch:function(){var a=
this.re,b=this.im;if(0===b)return new d(0!==a?Math.log(a+Math.sqrt(a*a+1)):Infinity,0);var c=a*a+b*b;return 0!==c?(new d(a/c,-b/c)).asinh():(new d(0!==a?a/0:0,0!==b?-b/0:0)).asinh()},asech:function(){var a=this.re,b=this.im;if(this.b())return d.INFINITY;var c=a*a+b*b;return 0!==c?(new d(a/c,-b/c)).acosh():(new d(0!==a?a/0:0,0!==b?-b/0:0)).acosh()},inverse:function(){if(this.b())return d.INFINITY;if(this.a())return d.ZERO;var a=this.re,b=this.im,c=a*a+b*b;return new d(a/c,-b/c)},conjugate:function(){return new d(this.re,
-this.im)},neg:function(){return new d(-this.re,-this.im)},ceil:function(a){a=Math.pow(10,a||0);return new d(Math.ceil(this.re*a)/a,Math.ceil(this.im*a)/a)},floor:function(a){a=Math.pow(10,a||0);return new d(Math.floor(this.re*a)/a,Math.floor(this.im*a)/a)},round:function(a){a=Math.pow(10,a||0);return new d(Math.round(this.re*a)/a,Math.round(this.im*a)/a)},equals:function(a,b){var c=new d(a,b);return Math.abs(c.re-this.re)<=d.EPSILON&&Math.abs(c.im-this.im)<=d.EPSILON},clone:function(){return new d(this.re,
this.im)},toString:function(){var a=this.re,b=this.im,c="";if(this.isNaN())return"NaN";if(this.b())return"0";if(this.a())return"Infinity";0!==a&&(c+=a);0!==b&&(0!==a?c+=0>b?" - ":" + ":0>b&&(c+="-"),b=Math.abs(b),1!==b&&(c+=b),c+="i");return c?c:"0"},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return(0===this.re||-0===this.re)&&(0===this.im||-0===this.im)},isFinite:function(){return isFinite(this.re)&&
isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}};d.ZERO=new d(0,0);d.ONE=new d(1,0);d.I=new d(0,1);d.PI=new d(Math.PI,0);d.E=new d(Math.E,0);d.INFINITY=new d(Infinity,Infinity);d.NAN=new d(NaN,NaN);d.EPSILON=1E-16;"function"===typeof define&&define.amd?define([],function(){return d}):"object"===typeof exports?(Object.defineProperty(exports,"__esModule",{value:!0}),d["default"]=d,d.Complex=d,module.exports=d):n.Complex=d})(this);
b){var c=new d(a,b);return this.isInfinite()&&c.isInfinite()?d.NAN:this.isInfinite()||c.isInfinite()?d.INFINITY:new d(this.re+c.re,this.im+c.im)},sub:function(a,b){var c=new d(a,b);return this.isInfinite()&&c.isInfinite()?d.NAN:this.isInfinite()||c.isInfinite()?d.INFINITY:new d(this.re-c.re,this.im-c.im)},mul:function(a,b){var c=new d(a,b);return this.isInfinite()&&c.isZero()||this.isZero()&&c.isInfinite()?d.NAN:this.isInfinite()||c.isInfinite()?d.INFINITY:0===c.im&&0===this.im?new d(this.re*c.re,
0):new d(this.re*c.re-this.im*c.im,this.re*c.im+this.im*c.re)},div:function(a,b){var c=new d(a,b);if(this.isZero()&&c.isZero()||this.isInfinite()&&c.isInfinite())return d.NAN;if(this.isInfinite()||c.isZero())return d.INFINITY;if(this.isZero()||c.isInfinite())return d.ZERO;a=this.re;b=this.im;var f=c.re,e=c.im;if(0===e)return new d(a/f,b/f);if(Math.abs(f)<Math.abs(e))return c=f/e,f=f*c+e,new d((a*c+b)/f,(b*c-a)/f);c=e/f;f=e*c+f;return new d((a+b*c)/f,(b-a*c)/f)},pow:function(a,b){var c=new d(a,b);
a=this.re;b=this.im;if(c.isZero())return d.ONE;if(0===c.im){if(0===b&&0<=a)return new d(Math.pow(a,c.re),0);if(0===a)switch((c.re%4+4)%4){case 0:return new d(Math.pow(b,c.re),0);case 1:return new d(0,Math.pow(b,c.re));case 2:return new d(-Math.pow(b,c.re),0);case 3:return new d(0,-Math.pow(b,c.re))}}if(0===a&&0===b&&0<c.re&&0<=c.im)return d.ZERO;var f=Math.atan2(b,a),e=m(a,b);a=Math.exp(c.re*e-c.im*f);b=c.im*e+c.re*f;return new d(a*Math.cos(b),a*Math.sin(b))},sqrt:function(){var a=this.re,b=this.im,
c=this.abs();if(0<=a){if(0===b)return new d(Math.sqrt(a),0);var f=.5*Math.sqrt(2*(c+a))}else f=Math.abs(b)/Math.sqrt(2*(c-a));a=0>=a?.5*Math.sqrt(2*(c-a)):Math.abs(b)/Math.sqrt(2*(c+a));return new d(f,0>b?-a:a)},exp:function(){var a=Math.exp(this.re);return new d(a*Math.cos(this.im),a*Math.sin(this.im))},expm1:function(){var a=this.re,b=this.im;var c=Math.PI/4;b<-c||b>c?c=Math.cos(b)-1:(c=b*b,c*=-.5+c*(1/24+c*(-1/720+c*(1/40320+c*(-1/3628800+c*(1/4790014600+c*(-1/87178291200+1/20922789888E3*c)))))));
return new d(Math.expm1(a)*Math.cos(b)+c,Math.exp(a)*Math.sin(b))},log:function(){var a=this.re,b=this.im;return new d(m(a,b),Math.atan2(b,a))},abs:function(){var a=this.re;var b=this.im,c=Math.abs(a),d=Math.abs(b);3E3>c&&3E3>d?a=Math.sqrt(c*c+d*d):(c<d?(c=d,d=a/b):d=b/a,a=c*Math.sqrt(1+d*d));return a},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var a=this.re,b=this.im;return new d(Math.sin(a)*e(b),Math.cos(a)*g(b))},cos:function(){var a=this.re,b=this.im;return new d(Math.cos(a)*
e(b),-Math.sin(a)*g(b))},tan:function(){var a=2*this.re,b=2*this.im,c=Math.cos(a)+e(b);return new d(Math.sin(a)/c,g(b)/c)},cot:function(){var a=2*this.re,b=2*this.im,c=Math.cos(a)-e(b);return new d(-Math.sin(a)/c,g(b)/c)},sec:function(){var a=this.re,b=this.im,c=.5*e(2*b)+.5*Math.cos(2*a);return new d(Math.cos(a)*e(b)/c,Math.sin(a)*g(b)/c)},csc:function(){var a=this.re,b=this.im,c=.5*e(2*b)-.5*Math.cos(2*a);return new d(Math.sin(a)*e(b)/c,-Math.cos(a)*g(b)/c)},asin:function(){var a=this.re,b=this.im,
c=(new d(b*b-a*a+1,-2*a*b)).sqrt();a=(new d(c.re-b,c.im+a)).log();return new d(a.im,-a.re)},acos:function(){var a=this.re,b=this.im,c=(new d(b*b-a*a+1,-2*a*b)).sqrt();a=(new d(c.re-b,c.im+a)).log();return new d(Math.PI/2-a.im,a.re)},atan:function(){var a=this.re,b=this.im;if(0===a){if(1===b)return new d(0,Infinity);if(-1===b)return new d(0,-Infinity)}var c=a*a+(1-b)*(1-b);a=(new d((1-b*b-a*a)/c,-2*a/c)).log();return new d(-.5*a.im,.5*a.re)},acot:function(){var a=this.re,b=this.im;if(0===b)return new d(Math.atan2(1,
a),0);var c=a*a+b*b;return 0!==c?(new d(a/c,-b/c)).atan():(new d(0!==a?a/0:0,0!==b?-b/0:0)).atan()},asec:function(){var a=this.re,b=this.im;if(0===a&&0===b)return new d(0,Infinity);var c=a*a+b*b;return 0!==c?(new d(a/c,-b/c)).acos():(new d(0!==a?a/0:0,0!==b?-b/0:0)).acos()},acsc:function(){var a=this.re,b=this.im;if(0===a&&0===b)return new d(Math.PI/2,Infinity);var c=a*a+b*b;return 0!==c?(new d(a/c,-b/c)).asin():(new d(0!==a?a/0:0,0!==b?-b/0:0)).asin()},sinh:function(){var a=this.re,b=this.im;return new d(g(a)*
Math.cos(b),e(a)*Math.sin(b))},cosh:function(){var a=this.re,b=this.im;return new d(e(a)*Math.cos(b),g(a)*Math.sin(b))},tanh:function(){var a=2*this.re,b=2*this.im,c=e(a)+Math.cos(b);return new d(g(a)/c,Math.sin(b)/c)},coth:function(){var a=2*this.re,b=2*this.im,c=e(a)-Math.cos(b);return new d(g(a)/c,-Math.sin(b)/c)},csch:function(){var a=this.re,b=this.im,c=Math.cos(2*b)-e(2*a);return new d(-2*g(a)*Math.cos(b)/c,2*e(a)*Math.sin(b)/c)},sech:function(){var a=this.re,b=this.im,c=Math.cos(2*b)+e(2*a);
return new d(2*e(a)*Math.cos(b)/c,-2*g(a)*Math.sin(b)/c)},asinh:function(){var a=this.im;this.im=-this.re;this.re=a;var b=this.asin();this.re=-this.im;this.im=a;a=b.re;b.re=-b.im;b.im=a;return b},acosh:function(){var a=this.acos();if(0>=a.im){var b=a.re;a.re=-a.im;a.im=b}else b=a.im,a.im=-a.re,a.re=b;return a},atanh:function(){var a=this.re,b=this.im,c=1<a&&0===b,e=1-a,g=1+a,h=e*e+b*b;a=0!==h?new d((g*e-b*b)/h,(b*e+g*b)/h):new d(-1!==a?a/0:0,0!==b?b/0:0);b=a.re;a.re=m(a.re,a.im)/2;a.im=Math.atan2(a.im,
b)/2;c&&(a.im=-a.im);return a},acoth:function(){var a=this.re,b=this.im;if(0===a&&0===b)return new d(0,Math.PI/2);var c=a*a+b*b;return 0!==c?(new d(a/c,-b/c)).atanh():(new d(0!==a?a/0:0,0!==b?-b/0:0)).atanh()},acsch:function(){var a=this.re,b=this.im;if(0===b)return new d(0!==a?Math.log(a+Math.sqrt(a*a+1)):Infinity,0);var c=a*a+b*b;return 0!==c?(new d(a/c,-b/c)).asinh():(new d(0!==a?a/0:0,0!==b?-b/0:0)).asinh()},asech:function(){var a=this.re,b=this.im;if(this.isZero())return d.INFINITY;var c=a*a+
b*b;return 0!==c?(new d(a/c,-b/c)).acosh():(new d(0!==a?a/0:0,0!==b?-b/0:0)).acosh()},inverse:function(){if(this.isZero())return d.INFINITY;if(this.isInfinite())return d.ZERO;var a=this.re,b=this.im,c=a*a+b*b;return new d(a/c,-b/c)},conjugate:function(){return new d(this.re,-this.im)},neg:function(){return new d(-this.re,-this.im)},ceil:function(a){a=Math.pow(10,a||0);return new d(Math.ceil(this.re*a)/a,Math.ceil(this.im*a)/a)},floor:function(a){a=Math.pow(10,a||0);return new d(Math.floor(this.re*
a)/a,Math.floor(this.im*a)/a)},round:function(a){a=Math.pow(10,a||0);return new d(Math.round(this.re*a)/a,Math.round(this.im*a)/a)},equals:function(a,b){var c=new d(a,b);return Math.abs(c.re-this.re)<=d.EPSILON&&Math.abs(c.im-this.im)<=d.EPSILON},clone:function(){return new d(this.re,this.im)},toString:function(){var a=this.re,b=this.im,c="";if(this.isNaN())return"NaN";if(this.isZero())return"0";if(this.isInfinite())return"Infinity";0!==a&&(c+=a);0!==b&&(0!==a?c+=0>b?" - ":" + ":0>b&&(c+="-"),b=Math.abs(b),
1!==b&&(c+=b),c+="i");return c?c:"0"},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return(0===this.re||-0===this.re)&&(0===this.im||-0===this.im)},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}};d.ZERO=new d(0,0);d.ONE=new d(1,0);d.I=new d(0,1);d.PI=new d(Math.PI,0);d.E=new d(Math.E,0);d.INFINITY=
new d(Infinity,Infinity);d.NAN=new d(NaN,NaN);d.EPSILON=1E-16;"function"===typeof define&&define.amd?define([],function(){return d}):"object"===typeof exports?(Object.defineProperty(exports,"__esModule",{value:!0}),d["default"]=d,d.Complex=d,module.exports=d):n.Complex=d})(this);

@@ -6,3 +6,3 @@ {

"title": "complex.js",
"version": "2.0.10",
"version": "2.0.11",
"description": "A complex number library",

@@ -9,0 +9,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc