From ce6b5d18da6c70940c6484982237085c274bf406 Mon Sep 17 00:00:00 2001 From: otya128 Date: Sat, 3 Sep 2016 18:49:24 +0900 Subject: [PATCH] =?UTF-8?q?SGN=E3=82=92=E3=82=88=E3=82=8A=E5=BF=A0?= =?UTF-8?q?=E5=AE=9F=E3=81=AA=E6=8C=99=E5=8B=95=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SMILEBASIC/builtinfunctions.d | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/SMILEBASIC/builtinfunctions.d b/SMILEBASIC/builtinfunctions.d index 592b1af..d69cc85 100644 --- a/SMILEBASIC/builtinfunctions.d +++ b/SMILEBASIC/builtinfunctions.d @@ -140,9 +140,13 @@ class BuiltinFunction 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) {