File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -162,21 +162,25 @@ public void initialize(PythonCore core) {
162
162
// abs(x)
163
163
@ Builtin (name = ABS , fixedNumOfArguments = 1 )
164
164
@ GenerateNodeFactory
165
- public abstract static class AbsNode extends PythonBuiltinNode {
165
+ public abstract static class AbsNode extends PythonUnaryBuiltinNode {
166
+ @ Specialization
167
+ public boolean absInt (boolean arg ) {
168
+ return arg ;
169
+ }
166
170
167
171
@ Specialization
168
172
public int absInt (int arg ) {
169
173
return Math .abs (arg );
170
174
}
171
175
172
176
@ Specialization
173
- public double absDouble ( double arg ) {
177
+ public long absInt ( long arg ) {
174
178
return Math .abs (arg );
175
179
}
176
180
177
181
@ Specialization
178
- public int absBoolean ( boolean arg ) {
179
- return arg ? 1 : 0 ;
182
+ public double absDouble ( double arg ) {
183
+ return Math . abs ( arg ) ;
180
184
}
181
185
182
186
@ Specialization
You can’t perform that action at this time.
0 commit comments