MCPcopy Create free account
hub / github.com/TheAlgorithms/Java / divide

Method divide

src/main/java/com/thealgorithms/maths/FFT.java:147–154  ·  view source on GitHub ↗

Divides this complex number by another. @param z The divisor. @return The quotient.

(Complex z)

Source from the content-addressed store, hash-verified

145 * @return The quotient.
146 */
147 public Complex divide(Complex z) {
148 Complex temp = new Complex();
149 double d = z.abs() * z.abs();
150 d = (double) Math.round(d * 1000000000d) / 1000000000d;
151 temp.real = (this.real * z.real + this.img * z.img) / (d);
152 temp.img = (this.img * z.real - this.real * z.img) / (d);
153 return temp;
154 }
155
156 /**
157 * Divides this complex number by a scalar.

Callers 9

divideWithComplexTestMethod · 0.95
divideWithScalarTestMethod · 0.95
inverseFFTMethod · 0.95
parenthesisMethod · 0.45
fftBluesteinMethod · 0.45
isProbablePrimeMethod · 0.45
jacobiSymbolMethod · 0.45
keyExpansionMethod · 0.45

Calls 2

absMethod · 0.45
roundMethod · 0.45

Tested by 3

divideWithComplexTestMethod · 0.76
divideWithScalarTestMethod · 0.76
parenthesisMethod · 0.36