Jump to content
  • Advertisement
Sign in to follow this  
Dark Schneider

How can be FLOAT grater than INT?

This topic is 4080 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am viewing the maximum number of any type and I read this: __int32 -> –2,147,483,648 to 2,147,483,647. float -> 3.4E +/- 38 (7 digits). then the float is able to be 3.4*10^38?, how it this possible if INT increments are by 1 and FLOAT increments are by <1 and both are 32 bits?. Am I wrong in anything?.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Dark Schneider
how it this possible if INT increments are by 1 and FLOAT increments are by <1 and both are 32 bits?

float increments are <1 only for small numbers.

Share this post


Link to post
Share on other sites
This is exactly the point of floating-point numbers. They are stored in what I've been brought up to call 'standard form', whereby the representation is split into the mantissa (a fixed list of digits) and the exponent (the position of the decimal place).

This exponential configuration means that the resolution of the number is not linear and depends on its size. So while an 'increment' may be fractionally small for small numbers, it is huge for big ones. You can verify this by adding 0.00001f to 1000000.0f and observing that it has no effect.

Admiral

Share this post


Link to post
Share on other sites
Floats are basically the same as what you see in windows calculator for very large numbers. It stores the mantissa and the exponent with real number being the mantissa being raised to the power of the exponent, loosing much precision at large values.

I don't know if this is any more clear...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!