Jump to content
  • Advertisement
Sign in to follow this  
luasitdown

Is the equal?

This topic is 4832 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

Advertisement
floating point types are not absolutely precise. They can only how so many significant figures. So in your cast is is like adding 10,000,000 + 1 = 10,000,001, except that since floats only have so many significant figures it rounds it back to 10,000,000. If you want something twice as precise use the double type instead. You will probably get better results. If that doesn't work, come back for fancier solutions.

Share this post


Link to post
Share on other sites
floats have around 24-bits of precision, doubles have around 53. f is about 10^16 times greater than ff. 10^16 is about 2^53... so even using a double is pushing it.

Share this post


Link to post
Share on other sites
You could try a long double.. Probably 64+ bits of precision (80 bits in total).. Still, never trust them to be accurate..

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!