summaryrefslogtreecommitdiffstatshomepage
path: root/tests/float/math_constants_extra.py
diff options
context:
space:
mode:
authorstijn <stijn@ignitron.net>2019-11-20 13:38:33 +0100
committerDamien George <damien@micropython.org>2022-01-23 09:28:33 +1100
commitdd6967202a734fce569127c07da7ed1e07ce8bc4 (patch)
treec6519e4f19dbf70efc0c99fd4f4f0e3a3c3f13b7 /tests/float/math_constants_extra.py
parente0b8d6982713c78169ec882770e746f2c5f4bc30 (diff)
downloadmicropython-dd6967202a734fce569127c07da7ed1e07ce8bc4.tar.gz
micropython-dd6967202a734fce569127c07da7ed1e07ce8bc4.zip
py/modmath: Add math.tau, math.nan and math.inf constants.
Configurable by the new MICROPY_PY_MATH_CONSTANTS option.
Diffstat (limited to 'tests/float/math_constants_extra.py')
-rw-r--r--tests/float/math_constants_extra.py17
1 files changed, 17 insertions, 0 deletions
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))