You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Vera Petrashkova (JIRA)" <ji...@apache.org> on 2007/01/19 10:04:29 UTC
[jira] Created: (HARMONY-3025) [drlvm][jit][opt] Conversion
operations return incorrect results on Jitrino OPT
[drlvm][jit][opt] Conversion operations return incorrect results on Jitrino OPT
-------------------------------------------------------------------------------
Key: HARMONY-3025
URL: https://issues.apache.org/jira/browse/HARMONY-3025
Project: Harmony
Issue Type: Bug
Components: DRLVM
Environment: Linux and Windows
Reporter: Vera Petrashkova
The following test demonstrates that conversion operations return incorrect results on Jitrino OPT
especially when Double, Float, Integer MAX_VALUEs are used in preliminary calculations.
-----------------
public class testConv {
static double dMAX = Double.MAX_VALUE;
static double dNEG = -1.000000E200;
static float fMAX = Float.MAX_VALUE;
public static void main(String[] args) {
testDMAX();
testDNEG();
testByte();
testShort();
testChar();
}
public static void testDMAX() {
System.out.println("Test: long * Double.MAX_VALUE / long");
long constLong1 = 1000;
long constLong2 = 10;
long result = ((long)(constLong1*dMAX))/constLong2;
if (result == Long.MAX_VALUE/10) {
System.out.println(" Test passed. result: " + result + " equals " + (Long.MAX_VALUE/10));
} else {
System.out.println(" Test failed. result: " + result + " does not equal " + (Long.MAX_VALUE/10));
}
}
public static void testDNEG() {
System.out.println("Test: long * -1.000000E200 / long");
int constInt1 = 800;
int constInt2 = 8;
int result = ((int)(constInt1*dNEG))/constInt2;
if (result == -268435456) {
System.out.println(" Test passed. result: " + result + " equals " + (-268435456));
} else {
System.out.println(" Test failed. result: " + result + " does not equal " + (-268435456));
}
}
public static void testByte() {
System.out.println("Test: convert Float.MAX_VALUE)/Integer.MAX_VALUE to byte");
byte result1 = (byte)(((byte) Float.MAX_VALUE)/Integer.MAX_VALUE);
byte result2 = (byte)(((byte) fMAX)/Integer.MAX_VALUE);
System.out.println("result1 = " + result1);
System.out.println("result2 = " + result2);
if (result1 == result2) {
System.out.println(" Test passed");
} else {
System.out.println(" Test failed: result != result2");
}
}
public static void testShort() {
System.out.println("Test: convert Double.MAX_VALUE)/Integer.MAX_VALUE to short");
short result1 = (short)(((short) Double.MAX_VALUE)/Integer.MAX_VALUE);
short result2 = (short)(((short) dMAX)/Integer.MAX_VALUE);
System.out.println("result1 = " + result1);
System.out.println("result2 = " + result2);
if (result1 == result2) {
System.out.println(" Test passed");
} else {
System.out.println(" Test failed: result != result2");
}
}
public static void testChar() {
System.out.println("Test: convert Float.MAX_VALUE)/Integer.MAX_VALUE to char");
char result1 = (char)(((char) Float.MAX_VALUE)/Integer.MAX_VALUE);
char result2 = (char)(((char) fMAX)/Integer.MAX_VALUE);
System.out.println("result1 = " + (int) result1);
System.out.println("result2 = " + (int) result2);
if (result1 == result2) {
System.out.println(" Test passed");
} else {
System.out.println(" Test failed: result != result2");
}
}
}
-------------------------
On Ia32 all testcases fail:
Test: long * Double.MAX_VALUE / long
Test failed. result: 0 does not equal 922337203685477580
Test: long * -1.000000E200 / long
Test failed. result: 0 does not equal -268435456
Test: convert Float.MAX_VALUE)/Integer.MAX_VALUE to byte
result1 = 0
result2 = 1
Test failed: result != result2
Test: convert Double.MAX_VALUE)/Integer.MAX_VALUE to short
result1 = 0
result2 = 1
Test failed: result != result2
Test: convert Float.MAX_VALUE)/Integer.MAX_VALUE to char
result1 = 0
result2 = 1
Test failed: result != result2
On EM64t output is
Test: long * Double.MAX_VALUE / long
Test passed. result: 922337203685477580 equals 922337203685477580
Test: long * -1.000000E200 / long
Test passed. result: -268435456 equals -268435456
Test: convert Float.MAX_VALUE)/Integer.MAX_VALUE to byte
result1 = 0
result2 = 1
Test failed: result != result2
Test: convert Double.MAX_VALUE)/Integer.MAX_VALUE to short
result1 = 0
result2 = 1
Test failed: result != result2
Test: convert Float.MAX_VALUE)/Integer.MAX_VALUE to char
result1 = 0
result2 = 1
Test failed: result != result2
On interpreter and Jitrino/JET all testcase of this test pass.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Assigned: (HARMONY-3025) [drlvm][jit][opt] Conversion
operations return incorrect results on Jitrino OPT
Posted by "Mikhail Fursov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-3025?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mikhail Fursov reassigned HARMONY-3025:
---------------------------------------
Assignee: Mikhail Fursov
> [drlvm][jit][opt] Conversion operations return incorrect results on Jitrino OPT
> -------------------------------------------------------------------------------
>
> Key: HARMONY-3025
> URL: https://issues.apache.org/jira/browse/HARMONY-3025
> Project: Harmony
> Issue Type: Bug
> Components: DRLVM
> Environment: Linux and Windows
> Reporter: Vera Petrashkova
> Assignee: Mikhail Fursov
>
> The following test demonstrates that conversion operations return incorrect results on Jitrino OPT
> especially when Double, Float, Integer MAX_VALUEs are used in preliminary calculations.
> -----------------
> public class testConv {
> static double dMAX = Double.MAX_VALUE;
> static double dNEG = -1.000000E200;
> static float fMAX = Float.MAX_VALUE;
> public static void main(String[] args) {
> testDMAX();
> testDNEG();
> testByte();
> testShort();
> testChar();
> }
> public static void testDMAX() {
> System.out.println("Test: long * Double.MAX_VALUE / long");
> long constLong1 = 1000;
> long constLong2 = 10;
> long result = ((long)(constLong1*dMAX))/constLong2;
> if (result == Long.MAX_VALUE/10) {
> System.out.println(" Test passed. result: " + result + " equals " + (Long.MAX_VALUE/10));
> } else {
> System.out.println(" Test failed. result: " + result + " does not equal " + (Long.MAX_VALUE/10));
> }
> }
> public static void testDNEG() {
> System.out.println("Test: long * -1.000000E200 / long");
> int constInt1 = 800;
> int constInt2 = 8;
> int result = ((int)(constInt1*dNEG))/constInt2;
> if (result == -268435456) {
> System.out.println(" Test passed. result: " + result + " equals " + (-268435456));
> } else {
> System.out.println(" Test failed. result: " + result + " does not equal " + (-268435456));
> }
> }
> public static void testByte() {
> System.out.println("Test: convert Float.MAX_VALUE)/Integer.MAX_VALUE to byte");
> byte result1 = (byte)(((byte) Float.MAX_VALUE)/Integer.MAX_VALUE);
> byte result2 = (byte)(((byte) fMAX)/Integer.MAX_VALUE);
> System.out.println("result1 = " + result1);
> System.out.println("result2 = " + result2);
> if (result1 == result2) {
> System.out.println(" Test passed");
> } else {
> System.out.println(" Test failed: result != result2");
> }
> }
>
> public static void testShort() {
> System.out.println("Test: convert Double.MAX_VALUE)/Integer.MAX_VALUE to short");
> short result1 = (short)(((short) Double.MAX_VALUE)/Integer.MAX_VALUE);
> short result2 = (short)(((short) dMAX)/Integer.MAX_VALUE);
> System.out.println("result1 = " + result1);
> System.out.println("result2 = " + result2);
> if (result1 == result2) {
> System.out.println(" Test passed");
> } else {
> System.out.println(" Test failed: result != result2");
> }
> }
> public static void testChar() {
> System.out.println("Test: convert Float.MAX_VALUE)/Integer.MAX_VALUE to char");
> char result1 = (char)(((char) Float.MAX_VALUE)/Integer.MAX_VALUE);
> char result2 = (char)(((char) fMAX)/Integer.MAX_VALUE);
> System.out.println("result1 = " + (int) result1);
> System.out.println("result2 = " + (int) result2);
> if (result1 == result2) {
> System.out.println(" Test passed");
> } else {
> System.out.println(" Test failed: result != result2");
> }
> }
> }
> -------------------------
> On Ia32 all testcases fail:
> Test: long * Double.MAX_VALUE / long
> Test failed. result: 0 does not equal 922337203685477580
> Test: long * -1.000000E200 / long
> Test failed. result: 0 does not equal -268435456
> Test: convert Float.MAX_VALUE)/Integer.MAX_VALUE to byte
> result1 = 0
> result2 = 1
> Test failed: result != result2
> Test: convert Double.MAX_VALUE)/Integer.MAX_VALUE to short
> result1 = 0
> result2 = 1
> Test failed: result != result2
> Test: convert Float.MAX_VALUE)/Integer.MAX_VALUE to char
> result1 = 0
> result2 = 1
> Test failed: result != result2
> On EM64t output is
> Test: long * Double.MAX_VALUE / long
> Test passed. result: 922337203685477580 equals 922337203685477580
> Test: long * -1.000000E200 / long
> Test passed. result: -268435456 equals -268435456
> Test: convert Float.MAX_VALUE)/Integer.MAX_VALUE to byte
> result1 = 0
> result2 = 1
> Test failed: result != result2
> Test: convert Double.MAX_VALUE)/Integer.MAX_VALUE to short
> result1 = 0
> result2 = 1
> Test failed: result != result2
> Test: convert Float.MAX_VALUE)/Integer.MAX_VALUE to char
> result1 = 0
> result2 = 1
> Test failed: result != result2
> On interpreter and Jitrino/JET all testcase of this test pass.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.