Floating-point math has an answer for everything, but sometimes that’s not what you want. Sometimes instead of getting an answer to the question sqrt(-1.0) (it’s NaN) it’s better to know that your …| Random ASCII - tech blog of Bruce Dawson
Riddle me this Batman: how much precision are these calculations evaluated at? If you answered ‘double’ and ‘float’ then you score one point for youthful idealism, but zero points for correctness. …| Random ASCII - tech blog of Bruce Dawson
After a recent post on float precision there was some debate about round-tripping of floats. My claim was that if you print a float with printf(“%1.8e”, f); and then scan it back in then you are gu…| Random ASCII - tech blog of Bruce Dawson
How much precision does a float have? It depends on the float, and it depends on what you mean by precision. Typical reasonable answers range from 6-9 decimal digits, but it turns out that you can …| Random ASCII - tech blog of Bruce Dawson
I promised in my last post to show an example of the importance of knowing how much precision a float has at a particular value. Here goes. As a general rule this type of data should never be store…| Random ASCII - tech blog of Bruce Dawson
This is a special bonus extra post in my floating-point series, ranting about an issue that has been a problem for years. Some debuggers don’t display floats with enough precision.| Random ASCII - tech blog of Bruce Dawson
Type Punning is Not a Joke I left the last post with a promise to share an interesting property of the IEEE float format. There are several equivalent ways of stating this property, and here are tw…| Random ASCII - tech blog of Bruce Dawson
Years ago I wrote an article about how to do epsilon floating-point comparisons by using integer comparisons. That article has been quite popular (it is frequently cited, and the code samples have …| Random ASCII - tech blog of Bruce Dawson
This post is a more carefully thought out and peer reviewed version of a floating-point comparison article I wrote many years ago. This one gives solid advice and some surprising observations about…| Random ASCII - tech blog of Bruce Dawson
Posts about Floating Point written by brucedawson| Random ASCII - tech blog of Bruce Dawson