-
Notifications
You must be signed in to change notification settings - Fork 20.8k
Closed
Description
Describe the bug
A clear and concise description of what the bug is.
There is a rounding error in the function. It arises when the function divides with (z.abs() * z.abs())
To Reproduce
Steps to reproduce the behavior:
Run this code to test it, either in main or a Junit test.:
FFT.Complex complex1 = new FFT.Complex(2.0,2.0);
FFT.Complex complex2 = new FFT.Complex(1.0,2.0);
double divReal = complex1.divide(complex2).getReal();
double divImg = complex1.divide(complex2).getImaginary();
assertEquals(1.2,divReal);
assertEquals(-0.4,divImg);
Expected behavior
The value from divReal should be 1.2 exactly, instead, it returns 1.199999...
Solution
A solution might be to round the value at 10^-9.
Metadata
Metadata
Assignees
Labels
No labels