Package fi.iki.jmtilli.javafastcomplex
Class ComplexUtils
java.lang.Object
fi.iki.jmtilli.javafastcomplex.ComplexUtils
public class ComplexUtils
extends java.lang.Object
A utility class for complex numbers.
This class contains static methods which can be used for objects
implementing the ComplexNumber interface.
-
Constructor Summary
Constructors Constructor Description ComplexUtils()
-
Method Summary
Modifier and Type Method Description static double
abs(ComplexNumber num)
Returns the absolute value of the complex number.static double
abs(ComplexNumberArray num, int i)
Returns the absolute value of the complex number.static Complex
acos(ComplexNumber c)
Calculate the inverse cosine of a complex number.static Complex
acos(ComplexNumberArray c, int i)
Calculate the inverse cosine of a complex number.static Complex
acosh(ComplexNumber c)
Calculate the inverse hyperbolic cosine of a complex number.static Complex
acosh(ComplexNumberArray c, int i)
Calculate the inverse hyperbolic cosine of a complex number.static Complex
add(double a, ComplexNumber b)
Add a complex number to a real numberstatic Complex
add(double a, ComplexNumberArray b, int j)
Add a complex number to a real numberstatic Complex
add(ComplexNumberArray a, int i, double b)
Add a real number to a complex numberstatic Complex
add(ComplexNumberArray a, int i, ComplexNumber b)
Add a complex number to a complex numberstatic Complex
add(ComplexNumberArray a, int i, ComplexNumberArray b, int j)
Add a complex number to a complex numberstatic Complex
add(ComplexNumber a, double b)
Add a real number to a complex numberstatic Complex
add(ComplexNumber a, ComplexNumber b)
Add a complex number to a complex numberstatic Complex
add(ComplexNumber a, ComplexNumberArray b, int j)
Add a complex number to a complex numberstatic double
arg(ComplexNumber num)
Calculates the argument of this complex number.static double
arg(ComplexNumberArray num, int i)
Calculates the argument of this complex number.static Complex
asin(ComplexNumber c)
Calculate the inverse sine of a complex number.static Complex
asin(ComplexNumberArray c, int i)
Calculate the inverse sine of a complex number.static Complex
asinh(ComplexNumber c)
Calculate the inverse hyperbolic sine of a complex number.static Complex
asinh(ComplexNumberArray c, int i)
Calculate the inverse hyperbolic sine of a complex number.static Complex
atan(ComplexNumber c)
Calculate the inverse tangent of a complex number.static Complex
atan(ComplexNumberArray c, int i)
Calculate the inverse tangent of a complex number.static Complex
atanh(ComplexNumber c)
Calculate the inverse hyperbolic tangent of a complex number.static Complex
atanh(ComplexNumberArray c, int i)
Calculate the inverse hyperbolic tangent of a complex number.static Complex
conjugate(ComplexNumber a)
Calculates the conjugate of a complex numberstatic Complex
conjugate(ComplexNumberArray a, int i)
Calculates the conjugate of a complex numberstatic Complex
cos(ComplexNumber c)
Calculate the cosine of a complex number.static Complex
cos(ComplexNumberArray c, int i)
Calculate the cosine of a complex number.static Complex
cosh(ComplexNumber c)
Calculate the hyperbolic cosine of a complex number.static Complex
cosh(ComplexNumberArray c, int i)
Calculate the hyperbolic cosine of a complex number.static Complex
divide(double d, ComplexNumber c)
Divide a real number by a complex numberstatic Complex
divide(double d, ComplexNumberArray c, int i)
Divide a real number by a complex numberstatic Complex
divide(ComplexNumberArray a, int i, double d)
Divide a complex number by a real numberstatic Complex
divide(ComplexNumberArray a, int i, ComplexNumber b)
Divide a complex number by a complex numberstatic Complex
divide(ComplexNumberArray a, int i, ComplexNumberArray b, int j)
Divide a complex number by a complex numberstatic Complex
divide(ComplexNumber a, double d)
Divide a complex number by a real numberstatic Complex
divide(ComplexNumber a, ComplexNumber b)
Divide a complex number by a complex numberstatic Complex
divide(ComplexNumber a, ComplexNumberArray b, int j)
Divide a complex number by a complex numberstatic boolean
equal(ComplexNumber a, ComplexNumber b)
Compare two complex numbers with all cases of NaN considered equal.static boolean
equalRealImag(ComplexNumber a, ComplexNumber b)
Compare the real and imaginary parts of two complex numbers.static Complex
exp(ComplexNumber c)
Calculates the exponential of the complex number.static Complex
exp(ComplexNumberArray c, int i)
Calculates the exponential of the complex number.static Complex
expm1(ComplexNumber c)
Returns exp(c)-1.static Complex
expm1(ComplexNumberArray c, int i)
Returns exp(c)-1.static int
hashCode(ComplexNumber c)
Returns a hash code of the complex number.static int
hashCode(ComplexNumberArray c, int i)
Returns a hash code of the complex number.static Complex
invert(ComplexNumber c)
Calculates the inverse of a complex numberstatic Complex
invert(ComplexNumberArray c, int i)
Calculates the inverse of a complex numberstatic boolean
isInfinite(ComplexNumber n)
Returns whether the complex number is infinite.static boolean
isInfinite(ComplexNumberArray n, int i)
Returns whether the complex number is infinite.static boolean
isNaN(ComplexNumber n)
Returns whether the complex number is NaN.static boolean
isNaN(ComplexNumberArray n, int i)
Returns whether the complex number is NaN.static Complex
log(ComplexNumber c)
Calculates the natural logarithm of the complex number.static Complex
log(ComplexNumberArray c, int i)
Calculates the natural logarithm of the complex number.static Complex
log1p(ComplexNumber c)
Returns log(c+1).static Complex
log1p(ComplexNumberArray c, int i)
Returns log(c+1).static boolean
longBitsEqual(ComplexNumber a, ComplexNumber b)
Compare the bit representations of real and imaginary parts of two complex numbers.static Complex
multiply(double d, ComplexNumber a)
Multiply a real number by a complex numberstatic Complex
multiply(double d, ComplexNumberArray a, int i)
Multiply a real number by a complex numberstatic Complex
multiply(int i, ComplexNumber a)
Multiply an integer by a complex numberstatic Complex
multiply(int x, ComplexNumberArray a, int i)
Multiply an integer by a complex numberstatic Complex
multiply(ComplexNumberArray a, int i, double d)
Multiply a complex number by a real numberstatic Complex
multiply(ComplexNumberArray a, int i, int x)
Multiply a complex number by an integerstatic Complex
multiply(ComplexNumberArray a, int i, ComplexNumber b)
Multiply a complex number by a complex numberstatic Complex
multiply(ComplexNumberArray a, int i, ComplexNumberArray b, int j)
Multiply a complex number by a complex numberstatic Complex
multiply(ComplexNumber a, double d)
Multiply a complex number by a real numberstatic Complex
multiply(ComplexNumber a, int i)
Multiply a complex number by an integerstatic Complex
multiply(ComplexNumber a, ComplexNumber b)
Multiply a complex number by a complex numberstatic Complex
multiply(ComplexNumber a, ComplexNumberArray b, int j)
Multiply a complex number by a complex numberstatic Complex
negate(ComplexNumber a)
Calculates the negation of a complex numberstatic Complex
negate(ComplexNumberArray a, int i)
Calculates the negation of a complex numberstatic Complex
newPolar(double abs, double argument)
Create a complex number from polar coordinates.static Complex
pow(ComplexNumberArray a, int i, double b)
Raise a complex number to a real powerstatic Complex
pow(ComplexNumberArray a, int i, ComplexNumber b)
Raise a complex number to a complex powerstatic Complex
pow(ComplexNumberArray a, int i, ComplexNumberArray b, int j)
Raise a complex number to a complex powerstatic Complex
pow(ComplexNumber a, double b)
Raise a complex number to a real powerstatic Complex
pow(ComplexNumber a, ComplexNumber b)
Raise a complex number to a complex powerstatic Complex
pow(ComplexNumber a, ComplexNumberArray b, int j)
Raise a complex number to a complex powerstatic Complex
sin(ComplexNumber c)
Calculate the sine of a complex number.static Complex
sin(ComplexNumberArray c, int i)
Calculate the sine of a complex number.static Complex
sinh(ComplexNumber c)
Calculate the hyperbolic sine of a complex number.static Complex
sinh(ComplexNumberArray c, int i)
Calculate the hyperbolic sine of a complex number.static Complex
sqrt(ComplexNumber c)
Calculates the square root of a complex numberstatic Complex
sqrt(ComplexNumberArray c, int i)
Calculates the square root of a complex numberstatic Complex
subtract(double a, ComplexNumber b)
Subtract a complex number from a real numberstatic Complex
subtract(double a, ComplexNumberArray b, int j)
Subtract a complex number from a real numberstatic Complex
subtract(ComplexNumberArray a, int i, double b)
Subtract a real number from a complex numberstatic Complex
subtract(ComplexNumberArray a, int i, ComplexNumber b)
Subtract a complex number from a complex numberstatic Complex
subtract(ComplexNumberArray a, int i, ComplexNumberArray b, int j)
Subtract a complex number from a complex numberstatic Complex
subtract(ComplexNumber a, double b)
Subtract a real number from a complex numberstatic Complex
subtract(ComplexNumber a, ComplexNumber b)
Subtract a complex number from a complex numberstatic Complex
subtract(ComplexNumber a, ComplexNumberArray b, int j)
Subtract a complex number from a complex numberstatic Complex
tan(ComplexNumber c)
Calculate the tangent of a complex number.static Complex
tan(ComplexNumberArray c, int i)
Calculate the tangent of a complex number.static Complex
tanh(ComplexNumber c)
Calculate the hyperbolic tangent of a complex number.static Complex
tanh(ComplexNumberArray c, int i)
Calculate the hyperbolic tangent of a complex number.static java.lang.String
toString(ComplexNumber num)
Returns a String representation of a complex number.static java.lang.String
toString(ComplexNumberArray num, int i)
Returns a String representation of a complex number.
-
Constructor Details
-
ComplexUtils
public ComplexUtils()
-
-
Method Details
-
isNaN
Returns whether the complex number is NaN. A comples number is considered NaN if either the real or imaginary part is NaN.- Parameters:
n
- The complex number- Returns:
- Whether the complex number is NaN
-
isNaN
Returns whether the complex number is NaN. A comples number is considered NaN if either the real or imaginary part is NaN.- Parameters:
n
- The complex number arrayi
- The array index- Returns:
- Whether the complex number is NaN
-
isInfinite
Returns whether the complex number is infinite. A comples number is considered infinite if either the real or imaginary part is infinite and the complex number is not NaN.- Parameters:
n
- The complex number- Returns:
- Whether the complex number is infinite
-
isInfinite
Returns whether the complex number is infinite. A comples number is considered infinite if either the real or imaginary part is infinite and the complex number is not NaN.- Parameters:
n
- The complex number arrayi
- The array index- Returns:
- Whether the complex number is infinite
-
abs
Returns the absolute value of the complex number. If the complex number is NaN, returns NaN. If the complex number is infinite, returns the infinity.- Parameters:
num
- The complex number- Returns:
- The absolute value of the complex number.
-
abs
Returns the absolute value of the complex number. If the complex number is NaN, returns NaN. If the complex number is infinite, returns the infinity.- Parameters:
num
- The complex number arrayi
- The array index- Returns:
- The absolute value of the complex number.
-
arg
Calculates the argument of this complex number. The argument is the angle between the positive real axis and the point that represents this number in the complex plane.- Parameters:
num
- The complex number- Returns:
- -pi≤x≤pi the argument
-
arg
Calculates the argument of this complex number. The argument is the angle between the positive real axis and the point that represents this number in the complex plane.- Parameters:
num
- The complex number arrayi
- The array index- Returns:
- -pi≤x≤pi the argument
-
newPolar
Create a complex number from polar coordinates.- Parameters:
abs
- The absolute valueargument
- The argument- Returns:
- The new complex number
-
pow
Raise a complex number to a real power- Parameters:
a
- The complex baseb
- The real power- Returns:
- The result
-
pow
Raise a complex number to a real power- Parameters:
a
- The complex base arrayi
- The array indexb
- The real power- Returns:
- The result
-
pow
Raise a complex number to a complex power- Parameters:
a
- The complex baseb
- The complex power- Returns:
- The result
-
pow
Raise a complex number to a complex power- Parameters:
a
- The complex base arrayi
- The array indexb
- The complex power- Returns:
- The result
-
pow
Raise a complex number to a complex power- Parameters:
a
- The complex base arrayi
- The array index of first arrayb
- The complex power araryj
- The array index of second array- Returns:
- The result
-
pow
Raise a complex number to a complex power- Parameters:
a
- The complex baseb
- The complex power arrayj
- The array index- Returns:
- The result
-
toString
Returns a String representation of a complex number.- Parameters:
num
- The complex number array- Returns:
- "NaN" if NaN
re if purely real
im+"i" if purely imaginary
(re + " + " + im + "i") if im>0
(re + " - " + (-im) + "i") if im<0
-
toString
Returns a String representation of a complex number.- Parameters:
num
- The complex number arrayi
- The array index- Returns:
- "NaN" if NaN
re if purely real
im+"i" if purely imaginary
(re + " + " + im + "i") if im>0
(re + " - " + (-im) + "i") if im<0
-
add
Add a complex number to a complex number- Parameters:
a
- A complex numberb
- A complex number- Returns:
- The sum
-
add
Add a complex number to a complex number- Parameters:
a
- A complex number arrayi
- The array indexb
- A complex number- Returns:
- The sum
-
add
Add a complex number to a complex number- Parameters:
a
- A complex number arrayi
- The array index to first arrayb
- A complex number arrayj
- The array index to second array- Returns:
- The sum
-
add
Add a complex number to a complex number- Parameters:
a
- A complex numberb
- A complex number arrayj
- The array index- Returns:
- The sum
-
add
Add a real number to a complex number- Parameters:
a
- The complex numberb
- The real number- Returns:
- The sum
-
add
Add a real number to a complex number- Parameters:
a
- The complex number arrayi
- The array indexb
- The real number- Returns:
- The sum
-
add
Add a complex number to a real number- Parameters:
a
- The real numberb
- The complex number- Returns:
- The sum
-
add
Add a complex number to a real number- Parameters:
a
- The real numberb
- The complex number arrayj
- The array index- Returns:
- The sum
-
subtract
Subtract a complex number from a complex number- Parameters:
a
- The minuendb
- The subtrahend- Returns:
- The difference
-
subtract
Subtract a complex number from a complex number- Parameters:
a
- The minuend arrayi
- The array indexb
- The subtrahend- Returns:
- The difference
-
subtract
Subtract a complex number from a complex number- Parameters:
a
- The minuend arrayi
- The first array indexb
- The subtrahend arrayj
- The second array index- Returns:
- The difference
-
subtract
Subtract a complex number from a complex number- Parameters:
a
- The minuendb
- The subtrahend arraryj
- The array index- Returns:
- The difference
-
subtract
Subtract a real number from a complex number- Parameters:
a
- The complex numberb
- The real number- Returns:
- The difference
-
subtract
Subtract a real number from a complex number- Parameters:
a
- The complex number arrayi
- The array indexb
- The real number- Returns:
- The difference
-
subtract
Subtract a complex number from a real number- Parameters:
a
- The real numberb
- The complex number- Returns:
- The difference
-
subtract
Subtract a complex number from a real number- Parameters:
a
- The real numberb
- The complex number arrayj
- The array index- Returns:
- The difference
-
multiply
Multiply a complex number by a complex number- Parameters:
a
- A complex numberb
- A complex number- Returns:
- The result of the multiplication
-
multiply
Multiply a complex number by a complex number- Parameters:
a
- A complex number arrayi
- The array indexb
- A complex number- Returns:
- The result of the multiplication
-
multiply
Multiply a complex number by a complex number- Parameters:
a
- A complex number arrayi
- The array index to first arrayb
- A complex number arrayj
- The array index to second array- Returns:
- The result of the multiplication
-
multiply
Multiply a complex number by a complex number- Parameters:
a
- A complex numberb
- A complex number araryj
- The array index- Returns:
- The result of the multiplication
-
divide
Divide a complex number by a complex number- Parameters:
a
- The dividendb
- The divisor- Returns:
- The result of the division
-
divide
Divide a complex number by a complex number- Parameters:
a
- The dividend arrayi
- The array indexb
- The divisor- Returns:
- The result of the division
-
divide
Divide a complex number by a complex number- Parameters:
a
- The dividend arrayi
- The array index to first arrayb
- The divisor arrayj
- The array index to second array- Returns:
- The result of the division
-
divide
Divide a complex number by a complex number- Parameters:
a
- The dividendb
- The divisor arrayj
- The array index- Returns:
- The result of the division
-
divide
Divide a complex number by a real number- Parameters:
a
- The complex numberd
- The real number- Returns:
- The result of the division
-
divide
Divide a complex number by a real number- Parameters:
a
- The complex number arrayi
- The array indexd
- The real number- Returns:
- The result of the division
-
multiply
Multiply a complex number by a real number- Parameters:
a
- The complex numberd
- The real number- Returns:
- The result of the multiplication
-
multiply
Multiply a complex number by a real number- Parameters:
a
- The complex number arrayi
- The array indexd
- The real number- Returns:
- The result of the multiplication
-
multiply
Multiply a real number by a complex number- Parameters:
d
- The real numbera
- The complex number- Returns:
- The result of the multiplication
-
multiply
Multiply a real number by a complex number- Parameters:
d
- The real numbera
- The complex number arrayi
- The array index- Returns:
- The result of the multiplication
-
multiply
Multiply a complex number by an integer- Parameters:
a
- The complex numberi
- The integer- Returns:
- The result of the multiplication
-
multiply
Multiply a complex number by an integer- Parameters:
a
- The complex number arrayi
- The array indexx
- The integer- Returns:
- The result of the multiplication
-
multiply
Multiply an integer by a complex number- Parameters:
i
- The integera
- The complex number- Returns:
- The result of the multiplication
-
multiply
Multiply an integer by a complex number- Parameters:
x
- The integera
- The complex number arrayi
- The array index- Returns:
- The result of the multiplication
-
negate
Calculates the negation of a complex number- Parameters:
a
- The complex number- Returns:
- -a
-
negate
Calculates the negation of a complex number- Parameters:
a
- The complex number arrayi
- The array index- Returns:
- -a
-
conjugate
Calculates the conjugate of a complex number- Parameters:
a
- The complex number- Returns:
- The complex conjugate of a
-
conjugate
Calculates the conjugate of a complex number- Parameters:
a
- The complex number arrayi
- The array index- Returns:
- The complex conjugate of a
-
divide
Divide a real number by a complex number- Parameters:
d
- The real numberc
- The complex number- Returns:
- The result of the division
-
divide
Divide a real number by a complex number- Parameters:
d
- The real numberc
- The complex number arrayi
- The array index- Returns:
- The result of the division
-
invert
Calculates the inverse of a complex number- Parameters:
c
- The complex number- Returns:
- 1 divided by c
-
invert
Calculates the inverse of a complex number- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- 1 divided by c
-
sqrt
Calculates the square root of a complex number- Parameters:
c
- The complex number- Returns:
- The square root of c
-
sqrt
Calculates the square root of a complex number- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- The square root of c
-
exp
Calculates the exponential of the complex number.- Parameters:
c
- The complex number- Returns:
- e raised to the power c
-
exp
Calculates the exponential of the complex number.- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- e raised to the power c
-
log
Calculates the natural logarithm of the complex number.- Parameters:
c
- The complex number- Returns:
- The natural logarithm
-
log
Calculates the natural logarithm of the complex number.- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- The natural logarithm
-
log1p
Returns log(c+1). For values of c near 0, calculating log1p(c) is much more accurate than calculating log(1+c).- Parameters:
c
- The complex number- Returns:
- The value log(1+x)
-
log1p
Returns log(c+1). For values of c near 0, calculating log1p(c) is much more accurate than calculating log(1+c).- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- The value log(1+x)
-
expm1
Returns exp(c)-1. For values of c near 0, calculating expm1(c) is much more accurate than calculating exp(c)-1.- Parameters:
c
- The complex number- Returns:
- The value exp(c)-1
-
expm1
Returns exp(c)-1. For values of c near 0, calculating expm1(c) is much more accurate than calculating exp(c)-1.- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- The value exp(c)-1
-
acosh
Calculate the inverse hyperbolic cosine of a complex number.- Parameters:
c
- The complex number- Returns:
- The inverse hyperbolic cosine of c
-
acosh
Calculate the inverse hyperbolic cosine of a complex number.- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- The inverse hyperbolic cosine of c
-
asinh
Calculate the inverse hyperbolic sine of a complex number.- Parameters:
c
- The complex number- Returns:
- The inverse hyperbolic sine of c
-
asinh
Calculate the inverse hyperbolic sine of a complex number.- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- The inverse hyperbolic sine of c
-
atanh
Calculate the inverse hyperbolic tangent of a complex number.- Parameters:
c
- The complex number- Returns:
- The inverse hyperbolic tangent of c
-
atanh
Calculate the inverse hyperbolic tangent of a complex number.- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- The inverse hyperbolic tangent of c
-
acos
Calculate the inverse cosine of a complex number.- Parameters:
c
- The complex number- Returns:
- The inverse cosine of c
-
acos
Calculate the inverse cosine of a complex number.- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- The inverse cosine of c
-
asin
Calculate the inverse sine of a complex number.- Parameters:
c
- The complex number- Returns:
- The inverse sine of c
-
asin
Calculate the inverse sine of a complex number.- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- The inverse sine of c
-
atan
Calculate the inverse tangent of a complex number.- Parameters:
c
- The complex number- Returns:
- The inverse tangent of c
-
atan
Calculate the inverse tangent of a complex number.- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- The inverse tangent of c
-
cos
Calculate the cosine of a complex number.- Parameters:
c
- The complex number- Returns:
- The cosine of c
-
cos
Calculate the cosine of a complex number.- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- The cosine of c
-
sin
Calculate the sine of a complex number.- Parameters:
c
- The complex number- Returns:
- The sine of c
-
sin
Calculate the sine of a complex number.- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- The sine of c
-
tan
Calculate the tangent of a complex number.- Parameters:
c
- The complex number- Returns:
- The tangent of c
-
tan
Calculate the tangent of a complex number.- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- The tangent of c
-
cosh
Calculate the hyperbolic cosine of a complex number.- Parameters:
c
- The complex number- Returns:
- The hyperbolic cosine of c
-
cosh
Calculate the hyperbolic cosine of a complex number.- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- The hyperbolic cosine of c
-
sinh
Calculate the hyperbolic sine of a complex number.- Parameters:
c
- The complex number- Returns:
- The hyperbolic sine of c
-
sinh
Calculate the hyperbolic sine of a complex number.- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- The hyperbolic sine of c
-
tanh
Calculate the hyperbolic tangent of a complex number.- Parameters:
c
- The complex number- Returns:
- The hyperbolic tangent of c
-
tanh
Calculate the hyperbolic tangent of a complex number.- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- The hyperbolic tangent of c
-
hashCode
Returns a hash code of the complex number. The hash code is based on the bit representations of the real and imaginary parts. If two complex numbers are considered equal by the equal method, they have the same hash code.- Parameters:
c
- The complex number- Returns:
- The hash code
-
hashCode
Returns a hash code of the complex number. The hash code is based on the bit representations of the real and imaginary parts. If two complex numbers are considered equal by the equal method, they have the same hash code.- Parameters:
c
- The complex number arrayi
- The array index- Returns:
- The hash code
-
equal
Compare two complex numbers with all cases of NaN considered equal. Note that this compares the bit representations of the real and imaginary parts. All instances of NaN are considered equal to each other. Thus for example NaN is equal to itself and +0.0+0.0i is not equal to -0.0-0.0i. This definition allows hash tables to work properly.- Returns:
- true if both complex numbers are NaN
true if the bit representations of the real and imaginary parts are equal
false otherwise
-
longBitsEqual
Compare the bit representations of real and imaginary parts of two complex numbers. Note that this compares the bit representations of the real and imaginary parts separately. Thus for example +0.0i+0.0i is not equal to -0.0-0.0i. Note that eg. NaN+0i is not equal to 0+NaNi, ie. all instances of NaN are not considered equal to each other.- Returns:
- true if the bit representations of the real and imaginary
parts are equal
false otherwise
-
equalRealImag
Compare the real and imaginary parts of two complex numbers. Note that this compares the real and imaginary parts with the "==" operator. Thus for example NaN is not equal to itself, and +0.0+0.0i is considered equal to -0.0-0.0i.- Returns:
- true if the the real and imaginary parts are equal with
the "==" comparison operator
false otherwise
-