...
| Code Block | ||
|---|---|---|
| ||
class WideSample {
public static void main(String[] args) {
int big = 1234567890;
float approx = big;
// The significand can store at most 23 bits
if(Integer.highestOneBit(big) > Math.pow(2, 23)) {
throw new ArithmeticException("Insufficient precision");
}
float approx = big;
System.out.println(big - (int)approx); //always prints zero now
}
} |
...