What Every Programmer Should Know About Floating-Point Arithmetic 359
-brazil- writes "Every programmer forum gets a steady stream of novice questions about numbers not 'adding up.' Apart from repetitive explanations, SOP is to link to a paper by David Goldberg which, while very thorough, is not very accessible for novices. To alleviate this, I wrote The Floating-Point Guide, as a floating-point equivalent to Joel Spolsky's excellent introduction to Unicode. In doing so, I learned quite a few things about the intricacies of the IEEE 754 standard, and just how difficult it is to compare floating-point numbers using an epsilon. If you find any errors or omissions, you can suggest corrections."
.9999999984 Post (Score:5, Funny)
Damn...Missed it! lol
Stop with the educational articles (Score:5, Funny)
Re:.9999999984 Post (Score:5, Funny)
I see you're still using that Pentium CPU.
Re:.9999999984 Post (Score:0, Funny)
This is what happens when you use intel cpus, if you want a ifsrt spto use an athlon and nothing can go rwnog.
Re:float are over (Score:5, Funny)
Really, the best answer is to store all numbers on the cloud, and just use a 256-bit GUID to look them up when needed.
Not equivalent to Spolsky's article. (Score:3, Funny)
It's missing the irritating cutesy "humor".
Re:Analog Computers (Score:3, Funny)
Nobody would expect someone to write down 1/3
I use base 3, so 0.1 is a perfectly easy number to express in floating point.
Re:Simple, effective and useful (Score:2, Funny)
The code on the site for
function nearlyEqual(a,b)
contains the line
if (a==0.0){
Clearly, this should be
if (nearlyEqual(a, 0.0)){
There. What could possibly go wrong now? :)
Re:Stop with the educational articles (Score:3, Funny)
Except for the fact that companies don't care about floating point they are looking for 3+ years on windows 7. 20 years of Linux. and 15 years of .NET.
Re:Simple, effective and useful (Score:5, Funny)
That would be because 0.1 + 02 is 2.1. :-)