Skip to content

Commit bdc9adc

Browse files
committed
Fehlerwerfen
1 parent fef68b4 commit bdc9adc

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

np_ones_zeros_math.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ def zeros(countx: int, county:int):
66
return [[0. for _ in range(county)] for _ in range(countx)]
77

88
def check_tolerance(a, b, abs_tol=0.0, rel_tol=1e-09, check_both=False):
9-
if check_both:
10-
return abs(a-b) <= min(rel_tol * max(abs(a), abs(b)), abs_tol)
11-
else:
12-
return (abs(a-b) <= rel_tol * max(abs(a), abs(b))) or (abs(a-b) <= abs_tol)
13-
9+
if type(abs_tol) is float and type(rel_tol) is float:
10+
if check_both:
11+
return abs(a-b) <= min(rel_tol * max(abs(a), abs(b)), abs_tol)
12+
else:
13+
return (abs(a-b) <= rel_tol * max(abs(a), abs(b))) or (abs(a-b) <= abs_tol)
14+
else:
15+
raise Exception("The values of abs or tol are wrong "+ str(abs_tol)+" "+str(rel_tol) +" "+ str(a)+ " "+ str(b))
1416

1517
def check_equality(a, b, abs=0.0, rel=1e-09, check_both=False):
1618
if type(a) is float and type(b) is float:

0 commit comments

Comments
 (0)