mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[complex.js] Update types to match implementation (#36396)
* [complex.js] Update types to match implementation * [complex.js] incorporate suggestions from review
This commit is contained in:
parent
19d3225506
commit
cebfdd1f30
@ -10,6 +10,7 @@ Complex.ONE;
|
||||
Complex.NAN;
|
||||
|
||||
new Complex(1, 0);
|
||||
new Complex(Complex.I);
|
||||
new Complex(1, 0).abs();
|
||||
new Complex(1, 0).acos();
|
||||
new Complex(1, 0).acot();
|
||||
@ -17,6 +18,7 @@ new Complex(1, 0).acoth();
|
||||
new Complex(1, 0).acsc();
|
||||
new Complex(1, 0).acsch();
|
||||
new Complex(1, 0).add(1, 2);
|
||||
new Complex(1, 0).add(Complex.I);
|
||||
new Complex(1, 0).arg();
|
||||
new Complex(1, 0).asec();
|
||||
new Complex(1, 0).asech();
|
||||
@ -34,7 +36,9 @@ new Complex(1, 0).coth();
|
||||
new Complex(1, 0).csc();
|
||||
new Complex(1, 0).csch();
|
||||
new Complex(1, 0).div(3, 1);
|
||||
new Complex(1, 0).div(Complex.I);
|
||||
new Complex(1, 0).equals(5, 3);
|
||||
new Complex(1, 0).equals(new Complex(5, 3));
|
||||
new Complex(1, 0).exp();
|
||||
new Complex(1, 0).floor(6);
|
||||
new Complex(1, 0).inverse();
|
||||
@ -44,8 +48,10 @@ new Complex(1, 0).isNaN();
|
||||
new Complex(1, 0).isZero();
|
||||
new Complex(1, 0).log();
|
||||
new Complex(1, 0).mul(3, 1);
|
||||
new Complex(1, 0).mul(Complex.I);
|
||||
new Complex(1, 0).neg();
|
||||
new Complex(1, 0).pow(1, 2);
|
||||
new Complex(1, 0).pow(Complex.I);
|
||||
new Complex(1, 0).round(3);
|
||||
new Complex(1, 0).sec();
|
||||
new Complex(1, 0).sech();
|
||||
@ -54,6 +60,7 @@ new Complex(1, 0).sin();
|
||||
new Complex(1, 0).sinh();
|
||||
new Complex(1, 0).sqrt();
|
||||
new Complex(1, 0).sub(5, 1);
|
||||
new Complex(1, 0).sub(Complex.I);
|
||||
new Complex(1, 0).tan();
|
||||
new Complex(1, 0).tanh();
|
||||
new Complex(1, 0).toString();
|
||||
|
||||
12
types/complex.js/index.d.ts
vendored
12
types/complex.js/index.d.ts
vendored
@ -45,6 +45,12 @@ declare class Complex {
|
||||
static EPSILON: number;
|
||||
|
||||
constructor(x: number, y: number);
|
||||
constructor(x: Complex);
|
||||
|
||||
// the real part of this complex number
|
||||
re: number;
|
||||
// the imaginary part of this complex number
|
||||
im: number;
|
||||
|
||||
/**
|
||||
* Returns the complex sign, defined as the complex number
|
||||
@ -56,26 +62,31 @@ declare class Complex {
|
||||
* Adds another complex number.
|
||||
*/
|
||||
add(a: number, b: number): Complex;
|
||||
add(a: Complex): Complex;
|
||||
|
||||
/**
|
||||
* Subtracts another complex number.
|
||||
*/
|
||||
sub(a: number, b: number): Complex;
|
||||
sub(a: Complex): Complex;
|
||||
|
||||
/**
|
||||
* Multiplies the number with another complex number.
|
||||
*/
|
||||
mul(a: number, b: number): Complex;
|
||||
mul(a: Complex): Complex;
|
||||
|
||||
/**
|
||||
* Divides the number by another complex number.
|
||||
*/
|
||||
div(a: number, b: number): Complex;
|
||||
div(a: Complex): Complex;
|
||||
|
||||
/**
|
||||
* Returns the number raised to the complex exponent.
|
||||
*/
|
||||
pow(a: number, b: number): Complex;
|
||||
pow(a: Complex): Complex;
|
||||
|
||||
/**
|
||||
* Returns the complex square root of the number.
|
||||
@ -137,6 +148,7 @@ declare class Complex {
|
||||
* if both numbers are infinite they are considered not equal.
|
||||
*/
|
||||
equals(a: number, b: number): boolean;
|
||||
equals(a: Complex): boolean;
|
||||
|
||||
/**
|
||||
* Checks if the given number is not a number.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user