-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
6
-
Cause Known
-
x86
-
linux
Name: rmT116609 Date: 05/11/2004
FULL PRODUCT VERSION :
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux pali 2.4.20-30.9 #1 Wed Feb 4 20:44:26 EST 2004 i686 i686 i386 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
The following code does not produce a compile time warning regarding precision.
int i=2;
double d = 2.5;
i*=d;
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expect the same compile time warning as i=i*d;
Test.java:6: possible loss of precision
found : double
required: int
i=d;
^
Test.java:7: possible loss of precision
found : double
required: int
i=i*d;
^
Test.java:8: possible loss of precision
found : double
required: int
i*=d;
^
3 errors
ACTUAL -
Test.java:6: possible loss of precision
found : double
required: int
i=d;
^
Test.java:7: possible loss of precision
found : double
required: int
i=i*d;
2 errors
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Test {
public void main (String [] args) {
int i = 1;
double d = 20.5;
i=d;
i=i*d;
i*=d;
}
}
---------- END SOURCE ----------
(Incident Review ID: 246582)
======================================================================
FULL PRODUCT VERSION :
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux pali 2.4.20-30.9 #1 Wed Feb 4 20:44:26 EST 2004 i686 i686 i386 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
The following code does not produce a compile time warning regarding precision.
int i=2;
double d = 2.5;
i*=d;
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expect the same compile time warning as i=i*d;
Test.java:6: possible loss of precision
found : double
required: int
i=d;
^
Test.java:7: possible loss of precision
found : double
required: int
i=i*d;
^
Test.java:8: possible loss of precision
found : double
required: int
i*=d;
^
3 errors
ACTUAL -
Test.java:6: possible loss of precision
found : double
required: int
i=d;
^
Test.java:7: possible loss of precision
found : double
required: int
i=i*d;
2 errors
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Test {
public void main (String [] args) {
int i = 1;
double d = 20.5;
i=d;
i=i*d;
i*=d;
}
}
---------- END SOURCE ----------
(Incident Review ID: 246582)
======================================================================