mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-26 03:38:25 +08:00
compiler: Add additional math fns available from Rust libm
This commit is contained in:
parent
a39bd69ca4
commit
d35f659d25
@ -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).
|
||||
|
@ -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))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user