This is for references, code examples, and discussion regarding the floating-point article in the October 2012 Game Developer Magazine.
Years ago I wrote an article on comparing floating-point numbers that became unexpectedly popular – despite numerous flaws. As an act of penance for its imperfect advice I wrote a series of blog posts discussing floating-point math. I then wrote a Game Developer Magazine article to summarize the most important points.
The entire series of posts can be found here: https://randomascii.wordpress.com/category/floating-point/
Specific articles relevant to the Game Developer Magazine article include:
- Stupid float tricks – the format of floating-point numbers
- Comparing floats – techniques for comparing floating-point numbers, plus discussion of precision problems
- Don’t store that in a float – a plea to not store elapsed game time in a float
- Exceptional floating point – using floating-point exceptions to find bugs
- Round-tripping of floats – how many digits should you use when printing floats?
- Testing the printing and scanning of all floats
- Intermediate precision – the complex and variable rules regarding expression evaluation, and their affect on performance and results
No floating-point article would be complete without a reference to David Goldberg’s classic article “What Every Computer Scientist Should Know About Floating-Point Arithmetic”. It was written in a time when the IEEE floating-point math standard was not yet universal, but it still contains important insights.
One of the creators if the IEEE floating-point math format is William Kahan and his lecture notes contain excellent insights.