Socket
Socket
Sign inDemoInstall

complex.js

Package Overview
Dependencies
0
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.6 to 2.0.7

2

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

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

/**
* @license Complex.js v2.0.6 11/02/2016
* @license Complex.js v2.0.7 11/02/2016
*

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

*
* const c = new Complex('99.3+8i');
* var c = new Complex('99.3+8i');
* c.mul({r: 3, i: 9}).div(4.9).sub(3, 2);

@@ -41,7 +41,7 @@ *

const cosh = function(x) {
var cosh = function(x) {
return (Math.exp(x) + Math.exp(-x)) * 0.5;
};
const sinh = function(x) {
var sinh = function(x) {
return (Math.exp(x) - Math.exp(-x)) * 0.5;

@@ -57,4 +57,4 @@ };

const cosm1 = function(x) {
const limit = Math.PI/4;
var cosm1 = function(x) {
var limit = Math.PI/4;
if (x < -limit || x > limit) {

@@ -64,3 +64,3 @@ return (Math.cos(x) - 1.0);

let xx = x * x;
var xx = x * x;
return xx *

@@ -84,6 +84,6 @@ (-0.5 + xx *

const hypot = function(x, y) {
var hypot = function(x, y) {
let a = Math.abs(x);
let b = Math.abs(y);
var a = Math.abs(x);
var b = Math.abs(y);

@@ -103,3 +103,3 @@ if (a < 3000 && b < 3000) {

const parser_exit = function() {
var parser_exit = function() {
throw SyntaxError('Invalid Param');

@@ -117,4 +117,4 @@ };

const _a = Math.abs(a);
const _b = Math.abs(b);
var _a = Math.abs(a);
var _b = Math.abs(b);

@@ -168,5 +168,5 @@ if (a === 0) {

const parse = function(a, b) {
var parse = function(a, b) {
const z = {'re': 0, 'im': 0};
var z = {'re': 0, 'im': 0};

@@ -212,5 +212,5 @@ if (a === undefined || a === null) {

const tokens = a.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g);
let plus = 1;
let minus = 0;
var tokens = a.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g);
var plus = 1;
var minus = 0;

@@ -221,5 +221,5 @@ if (tokens === null) {

for (let i = 0; i < tokens.length; i++) {
for (var i = 0; i < tokens.length; i++) {
const c = tokens[i];
var c = tokens[i];

@@ -295,3 +295,3 @@ if (c === ' ' || c === '\t' || c === '\n') {

const z = parse(a, b);
var z = parse(a, b);

@@ -314,3 +314,3 @@ this['re'] = z['re'];

const abs = this['abs']();
var abs = this['abs']();

@@ -329,3 +329,3 @@ return new Complex(

const z = new Complex(a, b);
var z = new Complex(a, b);

@@ -354,3 +354,3 @@ // Infinity + Infinity = NaN

const z = new Complex(a, b);
var z = new Complex(a, b);

@@ -379,3 +379,3 @@ // Infinity - Infinity = NaN

const z = new Complex(a, b);
var z = new Complex(a, b);

@@ -409,3 +409,3 @@ // Infinity * 0 = NaN

const z = new Complex(a, b);
var z = new Complex(a, b);

@@ -430,5 +430,5 @@ // 0 / 0 = NaN and Infinity / Infinity = NaN

const c = z['re'];
const d = z['im'];
let t, x;
var c = z['re'];
var d = z['im'];
var t, x;

@@ -467,3 +467,3 @@ if (0 === d) {

const z = new Complex(a, b);
var z = new Complex(a, b);

@@ -518,4 +518,4 @@ a = this['re'];

const arg = Math.atan2(b, a);
const loh = logHypot(a, b);
var arg = Math.atan2(b, a);
var loh = logHypot(a, b);

@@ -536,7 +536,7 @@ a = Math.exp(z['re'] * loh - z['im'] * arg);

const a = this['re'];
const b = this['im'];
const r = this['abs']();
var a = this['re'];
var b = this['im'];
var r = this['abs']();
let re, im;
var re, im;

@@ -570,3 +570,3 @@ if (a >= 0) {

const tmp = Math.exp(this['re']);
var tmp = Math.exp(this['re']);

@@ -597,4 +597,4 @@ if (this['im'] === 0) {

const a = this['re'];
const b = this['im'];
var a = this['re'];
var b = this['im'];

@@ -613,4 +613,4 @@ return new Complex(

const a = this['re'];
const b = this['im'];
var a = this['re'];
var b = this['im'];

@@ -655,4 +655,4 @@ if (b === 0 && a > 0) {

const a = this['re'];
const b = this['im'];
var a = this['re'];
var b = this['im'];

@@ -673,4 +673,4 @@ return new Complex(

const a = this['re'];
const b = this['im'];
var a = this['re'];
var b = this['im'];

@@ -691,5 +691,5 @@ return new Complex(

const a = 2 * this['re'];
const b = 2 * this['im'];
const d = Math.cos(a) + cosh(b);
var a = 2 * this['re'];
var b = 2 * this['im'];
var d = Math.cos(a) + cosh(b);

@@ -710,5 +710,5 @@ return new Complex(

const a = 2 * this['re'];
const b = 2 * this['im'];
const d = Math.cos(a) - cosh(b);
var a = 2 * this['re'];
var b = 2 * this['im'];
var d = Math.cos(a) - cosh(b);

@@ -729,5 +729,5 @@ return new Complex(

const a = this['re'];
const b = this['im'];
const d = 0.5 * cosh(2 * b) + 0.5 * Math.cos(2 * a);
var a = this['re'];
var b = this['im'];
var d = 0.5 * cosh(2 * b) + 0.5 * Math.cos(2 * a);

@@ -748,5 +748,5 @@ return new Complex(

const a = this['re'];
const b = this['im'];
const d = 0.5 * cosh(2 * b) - 0.5 * Math.cos(2 * a);
var a = this['re'];
var b = this['im'];
var d = 0.5 * cosh(2 * b) - 0.5 * Math.cos(2 * a);

@@ -767,10 +767,10 @@ return new Complex(

const a = this['re'];
const b = this['im'];
var a = this['re'];
var b = this['im'];
const t1 = new Complex(
var t1 = new Complex(
b * b - a * a + 1,
-2 * a * b)['sqrt']();
const t2 = new Complex(
var t2 = new Complex(
t1['re'] - b,

@@ -791,10 +791,10 @@ t1['im'] + a)['log']();

const a = this['re'];
const b = this['im'];
var a = this['re'];
var b = this['im'];
const t1 = new Complex(
var t1 = new Complex(
b * b - a * a + 1,
-2 * a * b)['sqrt']();
const t2 = new Complex(
var t2 = new Complex(
t1['re'] - b,

@@ -815,4 +815,4 @@ t1['im'] + a)['log']();

const a = this['re'];
const b = this['im'];
var a = this['re'];
var b = this['im'];

@@ -830,5 +830,5 @@ if (a === 0) {

const d = a * a + (1.0 - b) * (1.0 - b);
var d = a * a + (1.0 - b) * (1.0 - b);
const t1 = new Complex(
var t1 = new Complex(
(1 - b * b - a * a) / d,

@@ -849,4 +849,4 @@ -2 * a / d).log();

const a = this['re'];
const b = this['im'];
var a = this['re'];
var b = this['im'];

@@ -857,3 +857,3 @@ if (b === 0) {

const d = a * a + b * b;
var d = a * a + b * b;
return (d !== 0)

@@ -877,4 +877,4 @@ ? new Complex(

const a = this['re'];
const b = this['im'];
var a = this['re'];
var b = this['im'];

@@ -885,3 +885,3 @@ if (a === 0 && b === 0) {

const d = a * a + b * b;
var d = a * a + b * b;
return (d !== 0)

@@ -905,4 +905,4 @@ ? new Complex(

const a = this['re'];
const b = this['im'];
var a = this['re'];
var b = this['im'];

@@ -913,3 +913,3 @@ if (a === 0 && b === 0) {

const d = a * a + b * b;
var d = a * a + b * b;
return (d !== 0)

@@ -933,4 +933,4 @@ ? new Complex(

const a = this['re'];
const b = this['im'];
var a = this['re'];
var b = this['im'];

@@ -951,4 +951,4 @@ return new Complex(

const a = this['re'];
const b = this['im'];
var a = this['re'];
var b = this['im'];

@@ -969,5 +969,5 @@ return new Complex(

const a = 2 * this['re'];
const b = 2 * this['im'];
const d = cosh(a) + Math.cos(b);
var a = 2 * this['re'];
var b = 2 * this['im'];
var d = cosh(a) + Math.cos(b);

@@ -988,5 +988,5 @@ return new Complex(

const a = 2 * this['re'];
const b = 2 * this['im'];
const d = cosh(a) - Math.cos(b);
var a = 2 * this['re'];
var b = 2 * this['im'];
var d = cosh(a) - Math.cos(b);

@@ -1007,5 +1007,5 @@ return new Complex(

const a = this['re'];
const b = this['im'];
const d = Math.cos(2 * b) - cosh(2 * a);
var a = this['re'];
var b = this['im'];
var d = Math.cos(2 * b) - cosh(2 * a);

@@ -1026,5 +1026,5 @@ return new Complex(

const a = this['re'];
const b = this['im'];
const d = Math.cos(2 * b) + cosh(2 * a);
var a = this['re'];
var b = this['im'];
var d = Math.cos(2 * b) + cosh(2 * a);

@@ -1045,6 +1045,6 @@ return new Complex(

let tmp = this['im'];
var tmp = this['im'];
this['im'] = -this['re'];
this['re'] = tmp;
const res = this['asin']();
var res = this['asin']();

@@ -1069,9 +1069,9 @@ this['re'] = -this['im'];

const res = this['acos']();
var res = this['acos']();
if (res['im'] <= 0) {
let tmp = res['re'];
var tmp = res['re'];
res['re'] = -res['im'];
res['im'] = tmp;
} else {
let tmp = res['im'];
var tmp = res['im'];
res['im'] = -res['re'];

@@ -1092,11 +1092,11 @@ res['re'] = tmp;

const a = this['re'];
const b = this['im'];
var a = this['re'];
var b = this['im'];
const noIM = a > 1 && b === 0;
const oneMinus = 1 - a;
const onePlus = 1 + a;
const d = oneMinus * oneMinus + b * b;
var noIM = a > 1 && b === 0;
var oneMinus = 1 - a;
var onePlus = 1 + a;
var d = oneMinus * oneMinus + b * b;
const x = (d !== 0)
var x = (d !== 0)
? new Complex(

@@ -1109,3 +1109,3 @@ (onePlus * oneMinus - b * b) / d,

const temp = x['re'];
var temp = x['re'];
x['re'] = logHypot(x['re'], x['im']) / 2;

@@ -1128,4 +1128,4 @@ x['im'] = Math.atan2(x['im'], temp) / 2;

const a = this['re'];
const b = this['im'];
var a = this['re'];
var b = this['im'];

@@ -1136,3 +1136,3 @@ if (a === 0 && b === 0) {

const d = a * a + b * b;
var d = a * a + b * b;
return (d !== 0)

@@ -1156,4 +1156,4 @@ ? new Complex(

const a = this['re'];
const b = this['im'];
var a = this['re'];
var b = this['im'];

@@ -1168,3 +1168,3 @@ if (b === 0) {

const d = a * a + b * b;
var d = a * a + b * b;
return (d !== 0)

@@ -1188,4 +1188,4 @@ ? new Complex(

const a = this['re'];
const b = this['im'];
var a = this['re'];
var b = this['im'];

@@ -1196,3 +1196,3 @@ if (this.isZero()) {

const d = a * a + b * b;
var d = a * a + b * b;
return (d !== 0)

@@ -1223,6 +1223,6 @@ ? new Complex(

const a = this['re'];
const b = this['im'];
var a = this['re'];
var b = this['im'];
const d = a * a + b * b;
var d = a * a + b * b;

@@ -1303,3 +1303,3 @@ return new Complex(a / d, -b / d);

const z = new Complex(a, b);
var z = new Complex(a, b);

@@ -1327,5 +1327,5 @@ return Math.abs(z['re'] - this['re']) <= Complex['EPSILON'] &&

let a = this['re'];
let b = this['im'];
let ret = '';
var a = this['re'];
var b = this['im'];
var ret = '';

@@ -1332,0 +1332,0 @@ if (this.isNaN()) {

/*
Complex.js v2.0.6 11/02/2016
Complex.js v2.0.7 11/02/2016

@@ -4,0 +4,0 @@ Copyright (c) 2016, Robert Eisele (robert@xarg.org)

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

"title": "complex.js",
"version": "2.0.6",
"version": "2.0.7",
"description": "A complex number library",

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc