test/compiler/6796786/Test6796786.java

changeset 2879
37e4df3c8952
parent 2870
f1d6640088a1
child 6876
710a3c8b516e
equal deleted inserted replaced
2878:dcfb3dede009 2879:37e4df3c8952
25 /** 25 /**
26 * @test 26 * @test
27 * @bug 6796786 27 * @bug 6796786
28 * @summary invalid FP identity transform - (a - b) -> b - a 28 * @summary invalid FP identity transform - (a - b) -> b - a
29 * 29 *
30 * @run main Test6796786 30 * @run main/othervm -Xbatch Test6796786
31 */ 31 */
32 32
33 public class Test6796786 { 33 public class Test6796786 {
34 static volatile float d1; 34 static volatile float d1;
35 static volatile float d2; 35 static volatile float d2;
36 static float zero;
37 36
38 public static void main(String[] args) { 37 public static void main(String[] args) {
39 int total = 0; 38 int total = 0;
40 for (int i = 0; i < 100000; i++) { 39 for (int i = 0; i < 100000; i++) {
41 if (Float.floatToRawIntBits(- (d1 - d1)) == Float.floatToRawIntBits(0.0f)) { 40 if (Float.floatToRawIntBits(- (d1 - d2)) == Float.floatToRawIntBits(-0.0f)) {
42 total++; 41 total++;
43 } 42 }
44 } 43 }
45 if (total != 100000) { 44 if (total != 100000) {
46 throw new InternalError(); 45 throw new InternalError();

mercurial