Slashdot Mirror


Pet Bugs?

benreece asks: "During my few years as a programmer/developer I've come across some strange bugs. 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. I'm wondering what other obscure, weird, and especially annoying bugs in languages/compilers/etc have frustrated other developers." Memorable bugs. Every developer has one. What were yours?

2 of 985 comments (clear)

  1. Not a bug by Agthorr · · Score: 0, Redundant
    That's not a bug. It's a more accurate way to round off numbers. If you always round 5 up, that means you round 5 out of 9 numbers up, and 4 out of 9 numbers down. This can cause problems if you're rounding lots of numbers. A more accurate method is shown here , which matches the behavior shown.

    -- Agthorr

  2. It IS 83.84 by Transcendent · · Score: 1, Redundant

    That is not a bug.... but the truth. Dispite what your elementary teachers taught you about rounding, the rules are different...

    Basically... if the number (infront of the 5) is even, it stays even... if it's odd, then it goes even. The reason for this is to get rid (as much as possible) of rounding errors. So odd numbers round down, and even numbers round up... it evens out at the end...

    Rule of thumb: when rounding, try to get an even number...