java - Float vs Integer MAX_VALUE -


int , float has 4 bytes value.

if there such float value 0.5 int doesn't contain, there value int contains, float.

i'm assuming you're looking numbers can presented int, not float.

one of them integer.max_value.

int = integer.max_value; float f = i;      // or 2147483647f system.out.println(i); system.out.println(string.format("%f", f)); 

displays

2147483647 2147483648.000000 

this because while both have 32-bits float divides bits used sign (1 bit), exponent (8 bits) , significand or mantissa (23 bits).


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -