ABSをより忠実な挙動にした

This commit is contained in:
otya128 committed 2016-09-03 18:39:30 +09:00
1 parent 2705c0cd49
commit 23650bc2ad
1 file changed
+9 -2
+9 -2
View File
@@ -129,9 +129,16 @@ class BuiltinFunction
}*/ }*/
//static double function(double) ABS = &abs!double; //static double function(double) ABS = &abs!double;
//static double function(double) SGN = &sgn!double; //static double function(double) SGN = &sgn!double;
static pure nothrow double ABS(double arg1) static Value ABS(Value arg1)
{ {
return abs(arg1); if (arg1.isInteger)
{
return Value(abs(arg1.integerValue));
}
else
{
return Value(abs(arg1.castDouble));
}
} }
static pure nothrow double SGN(double arg1) static pure nothrow double SGN(double arg1)
{ {