[commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Fix subtle bug in binary search (46b3b9d)

git at git.haskell.org git at git.haskell.org
Mon Apr 17 21:34:08 UTC 2017


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

On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,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