Jump to content
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.
Posted 06 May 2012 - 09:31 AM