Name: yyT116575 Date: 03/26/2001
java version "1.2.2"
Classic VM (build JDK-1.2.2_006, native threads, symcjit)
I'm getting the wrong values returned off a division with both float and double
variables... The correct value for p should be 1.84, for some reason, its
returning 1.8399999999999999.
public class floattest {
public static void main( String[] args) {
double w, c, p;
w = 1280.00;
c = 2355.20;
System.out.println("w = " + w + "\n");
System.out.println("c = " + c + "\n");
p = c / w;
System.out.println("p = " + p + "\n");
}
}
(Review ID: 119499)
======================================================================
- relates to
-
JDK-4704007 (c = a - b ) or (a = c + b) maths equation false with double/float
-
- Closed
-
-
JDK-4950948 loop statements with double-type index, can ends at incorrect index.
-
- Closed
-
-
JDK-4430265 Double Addition yields extra zero output
-
- Closed
-