System.out.println(Float.MIN_VALUE+1); System.out.println(Float.MIN_VALUE); System.out.println(Float.MIN_VALUE-1); yeilded 1.0 1.4E-45 -1.0 where can I get some short notes on floating point operations? Your help needed .. ..
posted 13 years ago
One thing to keep in mind here is that Float.MIN_VALUE is the smallest positive value representable as a float. This is very different from Integer.MIN_VALUE which is a large negative number. I wish the designers of Java hadn't used the same name to mean two very different things. Floating point numbers have a limited amount of precision. If you add Float.MIN_VALUE (1e-45) to either 1 or -1, you will lose precision because there aren't enough bits available to represent 46 decimal places of precision.