You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
leren1
added a commit
to DD2480group1/Java
that referenced
this issue
Feb 24, 2022
Uh oh!
There was an error while loading. Please reload this page.
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.
The text was updated successfully, but these errors were encountered: