Skip to content

Commit 94f921c

Browse files
committed
Handle zero result in bisect benchmark
1 parent be164b6 commit 94f921c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mx.graalpython/mx_graalpython_bisect.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
22
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33
#
44
# The Universal Permissive License (UPL), Version 1.0
@@ -195,6 +195,8 @@ def bound_is_valid(self, bad_result):
195195

196196
def bound_is_significant(self, bad_result, epsilon):
197197
avg = (self.value + bad_result.value) / 2
198+
if not avg:
199+
return False
198200
diff = abs(self.value - bad_result.value)
199201
return diff / avg >= epsilon
200202

0 commit comments

Comments
 (0)