1
0

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

This commit is contained in:
otya128
2016-09-03 18:49:24 +09:00
parent 23650bc2ad
commit ce6b5d18da

View File

@@ -140,9 +140,13 @@ class BuiltinFunction
return Value(abs(arg1.castDouble)); return Value(abs(arg1.castDouble));
} }
} }
static pure nothrow double SGN(double arg1) static pure nothrow @nogc @trusted int SGN(double arg1)
{ {
return sgn(arg1); if (isNaN(arg1))
{
return 1;
}
return arg1 > 0 ? 1 : arg1 ? -1 : 0;
} }
static pure nothrow double SIN(double arg1) static pure nothrow double SIN(double arg1)
{ {