Integer and float storage capacity doubt

How is it possible then that the max value of int is 2^31, and the max value of float is 3.4*10^38, while both of them are 32 bits?
I think that int’s max value capacity should be higher than the float because it doesn’t save memory for the floating number and accepts only integer numbers.Please explain…

Hello @Sheenagoyal21,

The core idea of floating-point representations (as opposed to fixed point representations as used by, say, ints), is that a number x is written as m*be where m is a mantissa or fractional part, b is a base, and e is an exponent. On modern computers the base is almost always 2, and for most floating-point representations the mantissa will be scaled to be between 1 and b. This is done by adjusting the exponent.

range:(b±1.5 x 10−45 to ±3.4 x 1038
~6-9 digits
This the IEEE 754 standards of representing a 32 bits floating point number.

Watch this to better understand, how floating points are represented using IEEE 754 standards.
Click here.

Hope, this would help.
Give a like, if you are satisfied.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.