Advertisement Jump to content
Sign in to follow this  
luasitdown

Is the equal?

This topic is 4895 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!