forked from M-Labs/artiq
1
0
Fork 0

compiler: Add additional math fns available from Rust libm

This commit is contained in:
David Nadlinger 2020-08-09 20:03:34 +01:00
parent a39bd69ca4
commit d35f659d25
2 changed files with 11 additions and 2 deletions

View File

@ -15,6 +15,7 @@ unary_fp_intrinsics = [(name, "llvm." + name + ".f64") for name in [
"floor",
"ceil",
"trunc",
"sqrt",
]] + [
# numpy.rint() seems to (NumPy 1.19.0, Python 3.8.5, Linux x86_64)
# implement round-to-even, but unfortunately, rust-lang/libm only
@ -36,6 +37,14 @@ unary_fp_runtime_calls = [
("arcsin", "asin"),
("arccos", "acos"),
("arctan", "atan"),
("sinh", "sinh"),
("cosh", "cosh"),
("tanh", "tanh"),
("arcsinh", "asinh"),
("arccosh", "acosh"),
("arctanh", "atanh"),
("expm1", "expm1"),
("cbrt", "cbrt"),
]
#: Array handling builtins (special treatment due to allocations).

View File

@ -35,7 +35,7 @@ class CompareHostDeviceTest(ExperimentCase):
nonlocal checked
checked = True
self.assertTrue(
numpy.allclose(host, device),
numpy.allclose(host, device, equal_nan=True),
"Discrepancy in binop test for '{}': Expexcted ({}, {}) -> {}, got {}"
.format(op, a, b, host, device))
@ -56,7 +56,7 @@ class CompareHostDeviceTest(ExperimentCase):
nonlocal checked
checked = True
self.assertTrue(
numpy.allclose(host, device),
numpy.allclose(host, device, equal_nan=True),
"Discrepancy in unaryop test for '{}': Expexcted {} -> {}, got {}"
.format(op, a, host, device))