Skip to content

Commit 70308e6

Browse files
committed
Formatting
1 parent 9f69697 commit 70308e6

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ def result_check(expected, got, ulp_tol=5, abs_tol=0.0):
125125
return None
126126

127127
class MyFloat:
128-
def __float__(self):
129-
return 0.6
128+
def __float__(self):
129+
return 0.6
130130

131131
class MathTests(unittest.TestCase):
132132

@@ -143,6 +143,14 @@ def ftest(self, name, got, expected, ulp_tol=5, abs_tol=0.0):
143143
if failure is not None:
144144
self.fail("{}: {}".format(name, failure))
145145

146+
def testConstants(self):
147+
# Ref: Abramowitz & Stegun (Dover, 1965)
148+
self.ftest('pi', math.pi, 3.141592653589793238462643)
149+
self.ftest('e', math.e, 2.718281828459045235360287)
150+
if (sys.version_info.major >= 3 and sys.version_info.minor >= 6):
151+
# math.tau since 3.6
152+
self.assertEqual(math.tau, 2*math.pi)
153+
146154
def testAcos(self):
147155
self.assertRaises(TypeError, math.acos)
148156
self.ftest('acos(-1)', math.acos(-1), math.pi)
@@ -285,14 +293,6 @@ def testIsinf(self):
285293
self.assertFalse(math.isinf(BIG_INT))
286294
self.assertRaises(TypeError, math.isinf, 'ahoj')
287295
self.assertFalse(math.isinf(MyFloat()))
288-
289-
def testConstants(self):
290-
# Ref: Abramowitz & Stegun (Dover, 1965)
291-
self.ftest('pi', math.pi, 3.141592653589793238462643)
292-
self.ftest('e', math.e, 2.718281828459045235360287)
293-
if (sys.version_info.major >= 3 and sys.version_info.minor >= 6):
294-
# math.tau since 3.6
295-
self.assertEqual(math.tau, 2*math.pi)
296296

297297
def test_ceil_basic(self):
298298
self.assertEqual(math.ceil(10), 10)

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,31 +1158,31 @@ public abstract static class LogNode extends PythonUnaryBuiltinNode {
11581158
@Child private LookupAndCallUnaryNode valueDispatchNode;
11591159
@Child private LookupAndCallUnaryNode baseDispatchNode;
11601160
@Child private LogNode recLogNode;
1161-
1161+
11621162
private LookupAndCallUnaryNode getValueDispatchNode() {
11631163
if (valueDispatchNode == null) {
11641164
CompilerDirectives.transferToInterpreterAndInvalidate();
11651165
valueDispatchNode = insert(LookupAndCallUnaryNode.create(SpecialMethodNames.__FLOAT__));
11661166
}
11671167
return valueDispatchNode;
11681168
}
1169-
1169+
11701170
private LookupAndCallUnaryNode getBaseDispatchNode() {
11711171
if (baseDispatchNode == null) {
11721172
CompilerDirectives.transferToInterpreterAndInvalidate();
11731173
baseDispatchNode = insert(LookupAndCallUnaryNode.create(SpecialMethodNames.__FLOAT__));
11741174
}
11751175
return baseDispatchNode;
11761176
}
1177-
1177+
11781178
private double executeRecursiveLogNode(Object value, Object base) {
11791179
if (recLogNode == null) {
11801180
CompilerDirectives.transferToInterpreterAndInvalidate();
11811181
recLogNode = insert(LogNode.create());
11821182
}
11831183
return recLogNode.executeObject(value, base);
11841184
}
1185-
1185+
11861186
public abstract double executeObject(Object value, Object base);
11871187

11881188
private static final double LOG2 = Math.log(2.0);
@@ -1210,7 +1210,7 @@ private double countBase(BigInteger base, ConditionProfile divByZero) {
12101210
}
12111211
return logBase;
12121212
}
1213-
1213+
12141214
@Specialization
12151215
public double log(long value, @SuppressWarnings("unused") PNone novalue,
12161216
@Cached("createBinaryProfile()") ConditionProfile doNotFit) {
@@ -1345,18 +1345,18 @@ public double logDO(double value, Object base,
13451345
}
13461346

13471347
@Specialization(guards = {"!isNumber(base)"})
1348-
public double logPIO(PInt value, Object base,
1348+
public double logPIO(PInt value, Object base,
13491349
@Cached("createBinaryProfile()") ConditionProfile notNumberBase) {
13501350
Object resultBase = getRealNumber(base, getBaseDispatchNode(), notNumberBase);
13511351
return executeRecursiveLogNode(value, resultBase);
13521352
}
1353-
1353+
13541354
private void raiseMathError(ConditionProfile doNotFit, boolean con) {
13551355
if (doNotFit.profile(con)) {
13561356
throw raise(ValueError, "math domain error");
13571357
}
13581358
}
1359-
1359+
13601360
private Object getRealNumber(Object object, LookupAndCallUnaryNode dispatchNode, ConditionProfile isNotRealNumber) {
13611361
Object result = dispatchNode.executeObject(object);
13621362
if (result == PNone.NO_VALUE) {

0 commit comments

Comments
 (0)