Jump to content
Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 04 May 2012 - 07:49 PM
Posted 04 May 2012 - 08:35 PM
Edited by ApochPiQ, 04 May 2012 - 08:36 PM.
Posted 04 May 2012 - 10:08 PM
Posted 05 May 2012 - 01:48 AM
For base 2, yes, you can tell how many significant digits are present trivially: there are 23 in single precision IEEE floats, and 52 in double-precision. You can use simple bit-counting algorithms to count how many of them are relevant in a particular value.
Posted 05 May 2012 - 09:52 AM
Ignoring denormalized floats, I think there's 24 bits of precision, since there's an implicit leading one that is not stored.
That aside, Bruce Dawson digs into floats in a very nice manner, and has got a blog post about float precision in base 10. The TL;DR simplified answer is "... range from 6-9 decimal digits" and "Use 9 to play it safe."
Posted 05 May 2012 - 10:07 PM
Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.
Also check out my personal website at bryanwagstaff.com, where I occasionally write about assorted stuff.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.