mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-06 17:29:31 +08:00
@ -142,8 +142,10 @@ public class FFT {
|
|||||||
*/
|
*/
|
||||||
public Complex divide(Complex z) {
|
public Complex divide(Complex z) {
|
||||||
Complex temp = new Complex();
|
Complex temp = new Complex();
|
||||||
temp.real = (this.real * z.real + this.img * z.img) / (z.abs() * z.abs());
|
double d = z.abs() * z.abs();
|
||||||
temp.img = (this.img * z.real - this.real * z.img) / (z.abs() * z.abs());
|
d = (double)Math.round(d * 1000000000d) / 1000000000d;
|
||||||
|
temp.real = (this.real * z.real + this.img * z.img) / (d);
|
||||||
|
temp.img = (this.img * z.real - this.real * z.img) / (d);
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user