>
> 1 == 1.0
> 1 == 1.1
>
> 2 == 1.2
> 2 == 1.3
> 2 == 1.4
>
> All of the above are true -- what could be more clear? :)
I don't know what the heck you're learning from, but that's all kinds of
wrong. Here's a sample class:
public class test {
public static void main(String[] args) {
runTest(1, 1.0);
runTest(1, 1.1);
runTest(2, 1.2);
runTest(2, 1.3);
runTest(2, 1.4);
runTest(2, 1.5);
runTest(2, 2.0);
}
private static void runTest(int i, double f) {
System.out.println("" + i + " == " + f + " => " + (i == f));
}
}
And the output it generates:
1 == 1.0 => true
1 == 1.1 => false
2 == 1.2 => false
2 == 1.3 => false
2 == 1.4 => false
2 == 1.5 => false
2 == 2.0 => true
Which is exactly as you'd expect.
Cheers,
barneyb
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

