Mercurial > hg > graal-jvmci-8
comparison test/compiler/6796786/Test6796786.java @ 3347:37e4df3c8952
7042070: Typo in Test6796786.java
Summary: The test should compare with -0.0f.
Reviewed-by: never, iveresov
author | kvn |
---|---|
date | Wed, 04 May 2011 22:41:17 -0700 |
parents | f1d6640088a1 |
children |
comparison
equal
deleted
inserted
replaced
3346:dcfb3dede009 | 3347: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(); |