I am stuck in LAB-1007 Java Exceptions - 1.3 Experience various
exceptions

Whilst I still have not managed to sort out the problem with the code,
it does appear to identify a serious problem with the Java Maths
library.

Try in running the following, It appears to demonstrate a serious
problem with the multiplication of numbers.
(Running Win 7 32-bit)

Rory

File: MathsBug.java

/**
 * @author Rory O'Conor
 * [email protected]
 */
public class MathsBug {

    public static void main(String[] args) {
        double b;
        b = 1000 * 1000 * 1000;
        System.out.println("1000 * 1000 * 1000 = "+b);
        b = b * b;
        System.out.println("above squared = "+b);
        b = b * b;
        System.out.println("above squared again = "+b);
        b = 1000 * 1000 * 1000 * 1000;
        System.out.println("1000 * 1000 * 1000 * 1000 = "+b);
        System.out.println("Surely some mistake, says Rory.");
        b = b * b;
        System.out.println("above squared = "+b);
        System.out.println("Happy debugging!");
    }
}

-- 
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

Reply via email to