Blog Post: Caveats of Programming with Floating Point Numbers
Blog Post Suggestion
Authors
Reviewers
@o.knodel (Factual correctness) @hueser93 @frust45
Topic and Content
- Short introduction into the binary composition of floating point numbers (IEEE 754)
- Special cases of floating point representation (±0, ±∞, NaN)
- Caveat 1: Numeric instability, Reasons and examples
- Caveat 2: Comparisons and why a fixed Ɛ still is not sufficient
- Caveat 3: Computational Performance Impact
- Possible Alternatives
Target Audience
- Authors of code with high numerical volatility, e.g.
- Simulations of complex systems
- High-precision calculations
- Performance-critical applications
No special mathematical or technical knowledge is required. The topic will generally be presented in a programming-language-agnostic way. Practical examples in a specific language may be given to motivate the reader to try them for themselves. No complete proofs will be given for mathematical properties to not distract from the topic at hand.
Publishing Date
December 2019
Contribution
The post will educate scientists about the pitfalls of a seemingly comfortable solution for problems spanning multiple magnitudes of precision. It will educate the reader to recognize the impact of these caveats in their own code. Alternatives will be outlined to be adapted at the readers discretion.
Improvements in reproducibility, performance and stability can be expected if the programmer is aware of the presented topic.