[commit: packages/containers] develop-0.6, develop-0.6-questionable, master, zip-devel: Fix subtle bug in binary search (46b3b9d)

git at git.haskell.org git at git.haskell.org
Fri Dec 18 22:08:18 UTC 2015


Repository : ssh://git@git.haskell.org/containers

On branches: develop-0.6,develop-0.6-questionable,master,zip-devel
Link       : http://git.haskell.org/packages/containers.git/commitdiff/46b3b9d4b34e761aa6f75335c717742bc89d922d

>---------------------------------------------------------------

commit 46b3b9d4b34e761aa6f75335c717742bc89d922d
Author: Josh Acay <cacay at cmu.edu>
Date:   Tue Oct 14 14:42:17 2014 -0400

    Fix subtle bug in binary search


>---------------------------------------------------------------

46b3b9d4b34e761aa6f75335c717742bc89d922d
 Data/Graph.hs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Data/Graph.hs b/Data/Graph.hs
index c5cdf4b..65f3fb1 100644
--- a/Data/Graph.hs
+++ b/Data/Graph.hs
@@ -244,7 +244,7 @@ graphFromEdges edges0
                                    EQ -> Just mid
                                    GT -> findVertex (mid+1) b
                               where
-                                mid = (a + b) `div` 2
+                                mid = a + (b - a) `div` 2
 
 -------------------------------------------------------------------------
 --                                                                      -



More information about the ghc-commits mailing list