summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/float/math_constants.py11
-rw-r--r--tests/float/math_constants_extra.py17
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/float/math_constants.py b/tests/float/math_constants.py
new file mode 100644
index 0000000000..2e4c321052
--- /dev/null
+++ b/tests/float/math_constants.py
@@ -0,0 +1,11 @@
+# Tests various constants of the math module.
+try:
+ import math
+ from math import exp, cos
+except ImportError:
+ print("SKIP")
+ raise SystemExit
+
+print(math.e == exp(1.0))
+
+print(cos(math.pi))
diff --git a/tests/float/math_constants_extra.py b/tests/float/math_constants_extra.py
new file mode 100644
index 0000000000..dea49aef5a
--- /dev/null
+++ b/tests/float/math_constants_extra.py
@@ -0,0 +1,17 @@
+# Tests constants of the math module available only with MICROPY_PY_MATH_CONSTANTS.
+try:
+ import math
+ from math import isnan
+
+ math.tau
+except (ImportError, AttributeError):
+ print("SKIP")
+ raise SystemExit
+
+print(math.tau == 2.0 * math.pi)
+
+print(math.inf == float("inf"))
+print(-math.inf == -float("inf"))
+
+print(isnan(math.nan))
+print(isnan(-math.nan))