Skip to content

Commit 799d888

Browse files
committed
tests/float: Add domain checks for log and also -inf.
Signed-off-by: Damien George <damien@micropython.org>
1 parent fe330c7 commit 799d888

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/float/math_domain.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
("trunc", math.trunc, ()),
1818
("sqrt", math.sqrt, (-1, 0)),
1919
("exp", math.exp, ()),
20+
("log", math.log, ()),
2021
("sin", math.sin, ()),
2122
("cos", math.cos, ()),
2223
("tan", math.tan, ()),
@@ -27,7 +28,7 @@
2728
("radians", math.radians, ()),
2829
("degrees", math.degrees, ()),
2930
):
30-
for x in args + (inf, nan):
31+
for x in args + (inf, -inf, nan):
3132
try:
3233
ans = f(x)
3334
print("%.4f" % ans)
@@ -39,6 +40,7 @@
3940
# double argument functions
4041
for name, f, args in (
4142
("pow", math.pow, ((0, 2), (-1, 2), (0, -1), (-1, 2.3), (nan, 0), (1, nan))),
43+
("log", math.log, ()),
4244
("fmod", math.fmod, ((1.2, inf), (1.2, -inf), (1.2, 0), (inf, 1.2))),
4345
("atan2", math.atan2, ((0, 0), (-inf, inf), (-inf, -inf), (inf, -inf))),
4446
("copysign", math.copysign, ()),

0 commit comments

Comments
 (0)