tests/float: Add domain checks for log and also -inf.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
fe330c74f4
commit
799d888182
@ -17,6 +17,7 @@ for name, f, args in (
|
|||||||
("trunc", math.trunc, ()),
|
("trunc", math.trunc, ()),
|
||||||
("sqrt", math.sqrt, (-1, 0)),
|
("sqrt", math.sqrt, (-1, 0)),
|
||||||
("exp", math.exp, ()),
|
("exp", math.exp, ()),
|
||||||
|
("log", math.log, ()),
|
||||||
("sin", math.sin, ()),
|
("sin", math.sin, ()),
|
||||||
("cos", math.cos, ()),
|
("cos", math.cos, ()),
|
||||||
("tan", math.tan, ()),
|
("tan", math.tan, ()),
|
||||||
@ -27,7 +28,7 @@ for name, f, args in (
|
|||||||
("radians", math.radians, ()),
|
("radians", math.radians, ()),
|
||||||
("degrees", math.degrees, ()),
|
("degrees", math.degrees, ()),
|
||||||
):
|
):
|
||||||
for x in args + (inf, nan):
|
for x in args + (inf, -inf, nan):
|
||||||
try:
|
try:
|
||||||
ans = f(x)
|
ans = f(x)
|
||||||
print("%.4f" % ans)
|
print("%.4f" % ans)
|
||||||
@ -39,6 +40,7 @@ for name, f, args in (
|
|||||||
# double argument functions
|
# double argument functions
|
||||||
for name, f, args in (
|
for name, f, args in (
|
||||||
("pow", math.pow, ((0, 2), (-1, 2), (0, -1), (-1, 2.3), (nan, 0), (1, nan))),
|
("pow", math.pow, ((0, 2), (-1, 2), (0, -1), (-1, 2.3), (nan, 0), (1, nan))),
|
||||||
|
("log", math.log, ()),
|
||||||
("fmod", math.fmod, ((1.2, inf), (1.2, -inf), (1.2, 0), (inf, 1.2))),
|
("fmod", math.fmod, ((1.2, inf), (1.2, -inf), (1.2, 0), (inf, 1.2))),
|
||||||
("atan2", math.atan2, ((0, 0), (-inf, inf), (-inf, -inf), (inf, -inf))),
|
("atan2", math.atan2, ((0, 0), (-inf, inf), (-inf, -inf), (inf, -inf))),
|
||||||
("copysign", math.copysign, ()),
|
("copysign", math.copysign, ()),
|
||||||
|
Loading…
Reference in New Issue
Block a user