Developing Programmers .com

Local Search:



This site is optimized for standards so you can use any standards compliant browser:

Valid XHTML 1.0 Transitional
Valid CSS!
(RSS) RSS Feed

Web Search:
Google


Sunday, 4 June, 2006

Google Points Out Lurking Bug  

Joshua Bloch has posted on the Official Research Blog about how most binary search and merge sort code is broken and has been for years.

The bug is to do with large arrays, and highlights how often programmers accept code that will do “for the examples we have right now” rather than considering whether it’ll work “in every situation where a future programmer might expect it to work”. It’s great to re-use code, but make sure it is re-usable beyond toy examples!

Joshua’s article is well worth a read.

Posted by sarah at 12:39 pm in: Plugs , Quality (11331 views)

2 Comments

  1. That’s nothing to do with sorting, though, and absolutely nothing to do with mergesort…

    It’s just a standard “fixed length ints are not integers” problem.

    Jiri

    Comment by jiri — On 4-6-2006 at 4:30:52 PM

  2. That’s nothing to do with sorting,
    though, and absolutely nothing
    to do with mergesort…
    It’s just a standard “fixed length ints
    are not integers” problem.

    it’s like asking

    (1.0/3.0 + 1.0/3.0 + 1.0/3.0) // is this equal to 1.0 exactly?
    no bitwise for google….:-(

    Comment by joako — On 1-5-2007 at 1:49:30 PM

Please use the DP Forums for further discussion of this topic.