I was trying to cast a double
value to int
and I got a different value.
I have this code:
double double100times = 240;
int a=[[NSNumber numberWithDouble:double100times] intValue];
and the value I get from this is a=239
.
If I use int a= (int)double100times
instead I get the same value.
Why is this?
UPDATE: If I use double double100times = 240; works, but I'm using:
double double100times = (2.3*100)+10;