Skip to content

Commit 4b249d4

Browse files
committed
[GR-10323] Constant Math.tau is missing.
1 parent 4634b94 commit 4b249d4

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_math.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ def ftest(self, name, got, expected, ulp_tol=5, abs_tol=0.0):
102102
if failure is not None:
103103
self.fail("{}: {}".format(name, failure))
104104

105+
def testConstants(self):
106+
# Ref: Abramowitz & Stegun (Dover, 1965)
107+
self.ftest('pi', math.pi, 3.141592653589793238462643)
108+
self.ftest('e', math.e, 2.718281828459045235360287)
109+
self.assertEqual(math.tau, 2*math.pi)
110+
105111
def test_ceil_basic(self):
106112
self.assertEqual(math.ceil(10), 10)
107113
self.assertEqual(math.ceil(-10), -10)

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/MathModuleBuiltins.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public MathModuleBuiltins() {
6868
// Add constant values
6969
builtinConstants.put("pi", Math.PI);
7070
builtinConstants.put("e", Math.E);
71+
builtinConstants.put("tau", 2*Math.PI);
7172
}
7273

7374
// math.sqrt

0 commit comments

Comments
 (0)