Skip to content

Commit 33da7fb

Browse files
committed
disable atan2 checks (slow and more confusing)
1 parent bce9666 commit 33da7fb

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

src/main/java/fr/jmmc/jmcs/util/NumberUtils.java

-24
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ public final class NumberUtils {
4949

5050
/** Smallest positive number used in double comparisons (rounding). */
5151
public final static double EPSILON = 1e-6;
52-
/* PI and PI/2 constants */
53-
public final static double PI = Math.PI;
54-
public final static double PI_HALF = PI / 2.0;
55-
/** Typical scale precision in re/im comparisons (rounding). */
56-
public static final double ARG_EPSILON = Math.ulp(1.0);
5752
/* shared Double instances */
5853
/** shared Double = NaN instance */
5954
public final static Double DBL_NAN = Double.valueOf(Double.NaN);
@@ -71,25 +66,6 @@ public static double getArgumentInDegrees(final double re, final double im) {
7166
}
7267

7368
public static double getArgument(final double re, final double im) {
74-
// check |re| == 0
75-
final double normRe = Math.abs(re);
76-
if (normRe == 0.0) {
77-
return (im >= 0.0) ? PI_HALF : -PI_HALF;
78-
}
79-
// check |im| == 0
80-
final double normIm = Math.abs(im);
81-
if (normIm == 0.0) {
82-
return (re >= 0.0) ? 0.0 : PI;
83-
}
84-
final double epsilon = ARG_EPSILON * (normRe + normIm);
85-
// check |re| << |im| or |im| << |re|
86-
if (normIm <= epsilon) {
87-
return (re >= 0.0) ? 0.0 : PI;
88-
}
89-
// check |im| << |re|
90-
if (normRe <= epsilon) {
91-
return (im >= 0.0) ? PI_HALF : -PI_HALF;
92-
}
9369
return Math.atan2(im, re);
9470
}
9571

0 commit comments

Comments
 (0)