Wednesday, 26 June, 2002
Is That a Bug or a Stupid Programmer?
Slashdot ran a piece today about pet bugs—a programmer asking about "obscure, weird, and especially annoying bugs in languages/compilers/etc" that have frustrated developers. In his query, the author writes:
Recently I found that Microsoft's VB/VBScript(ASP) round function has problems (for example, 'round(82.845)' returns '82.84' instead of '82.85'). It took me an annoyingly long time to realize the problem wasn't mine.
Never mind that this is the documented behavior of the Visual Basic round function, and in full accordance with the IEEE 754 standard. Bankers, scientists, mathematicians, and anybody else who works with numbers have been rounding this way for over a century.
I find it difficult to believe that the person who posted the piece on Slashdot is actually paid to write computer programs. You'd think that, if he suspected there was a problem with the function, he'd search the Microsoft knowledge base or, horror of horrors, read the documentation. I suspect that this person is deeply embarrassed right about now.
This ill-informed note reminded me of the compiler bug that has frustrated me the most in my career—programmers who automatically assume that their code is right and the compiler is wrong. I can't count the number of times a programmer has asked my assistance in isolating a compiler or runtime library bug when he hasn't yet fully checked his own code. Sure, compiler and runtime library bugs exist, but they're very rare. If there's a bug in your program, it's most likely of your own making.