-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJDK-8349364.java
More file actions
35 lines (34 loc) · 1.35 KB
/
JDK-8349364.java
File metadata and controls
35 lines (34 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
public class Test1 {
public static double test(final double a1, final double b1, final double a2, final double b2) {
final double x = Double.longBitsToDouble(
Double.doubleToRawLongBits((double) a1) & (long) (8411500938693120034L << -173714142));
final double y = (double) ((x + b1) / (((x * (b1 % x)) % (x - a1)) - (b1 - x)));
// Adding this if statement makes C1 fast
if (Double.isNaN(a1)) {
System.out.println("a1 is NaN");
}
return (double) a2;
}
public static void main(String[] args) {
int N = 10000000;
double[] res = new double[N];
for (int i = 0; i < N; ++i) {
res[i] = test((double) 'a', 100, 10L, 100.0d);
}
}
}
public class Test2 {
public static double test(final double a1, final double b1, final double a2, final double b2) {
final double x = Double.longBitsToDouble(
Double.doubleToRawLongBits((double) a1) & (long) (8411500938693120034L << -173714142));
final double y = (double) ((x + b1) / (((x * (b1 % x)) % (x - a1)) - (b1 - x)));
return (double) a2;
}
public static void main(String[] args) {
int N = 10000000;
double[] res = new double[N];
for (int i = 0; i < N; ++i) {
res[i] = test((double) 'a', 100, 10L, 100.0d);
}
}
}