sorted
public class MathsBug {
public static void main(String[] args) {
double b = 0.0;
b = 1000 * 1000 * 1000;
System.out.println("1000 * 1000 * 1000 = "+b);
b = b * b;
System.out.println("above squared = "+b);
b = 1000 * 1000 * 1000 * 1000;
System.out.println("1000 * 1000 * 1000 * 1000 = "+b);
System.out.println("Surely some mistake!");
b = 1000.0 * 1000 * 1000 * 1000;
System.out.println("1000.0 * 1000 * 1000 * 1000 = "+b);
b = (double) 1000 * 1000 * 1000 * 1000;
System.out.println("(double) 1000 * 1000 * 1000 * 1000 = "+b);
}
}
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en