sedj
Programmer
- Aug 6, 2002
- 5,610
Platform : Intel 32 bit, Linux 2.6 kernel, GCC 4.0.* compiler.
Say I have an two ints (which are the same), and cast them to doubles (with some division) :
Will an equality comparison always result in a 'true' ?
So will this always be true :
In "text" representation I would normally expect both 'd' and 'd2' to be "123.1".
But is this the case ?
Would the double, under any circumstances be, say, "123.099999999" ?
Thanks for any help
--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
Say I have an two ints (which are the same), and cast them to doubles (with some division) :
Code:
int i = 1231;
double d = (double)( i / 10.0 );
int i2 = 1231;
double d2 = (double)( d2 / 10.0 );
Will an equality comparison always result in a 'true' ?
So will this always be true :
Code:
bool b = ( d == d2 );
In "text" representation I would normally expect both 'd' and 'd2' to be "123.1".
But is this the case ?
Would the double, under any circumstances be, say, "123.099999999" ?
Thanks for any help
--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software