From 25894bd009d50ec8a490877d514c39f67ac11e24 Mon Sep 17 00:00:00 2001 From: otya128 Date: Sat, 3 Sep 2016 19:03:56 +0900 Subject: [PATCH] =?UTF-8?q?FLOOR,ROUND,CEIL=E3=82=92=E3=82=88=E3=82=8A?= =?UTF-8?q?=E5=BF=A0=E5=AE=9F=E3=81=AA=E6=8C=99=E5=8B=95=E3=81=AB=E3=81=97?= =?UTF-8?q?=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SMILEBASIC/builtinfunctions.d | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/SMILEBASIC/builtinfunctions.d b/SMILEBASIC/builtinfunctions.d index d69cc85..556229c 100644 --- a/SMILEBASIC/builtinfunctions.d +++ b/SMILEBASIC/builtinfunctions.d @@ -804,17 +804,32 @@ class BuiltinFunction else return 0; } - static nothrow double FLOOR(double val) + static Value FLOOR(Value val) { - return val.floor; + if (val.isInteger) + { + return val; + } + + return Value(val.doubleValue.floor); } - static nothrow double ROUND(double val) + static Value ROUND(Value val) { - return val.round; + if (val.isInteger) + { + return val; + } + + return Value(val.doubleValue.round); } - static nothrow double CEIL(double val) + static Value CEIL(Value val) { - return val.ceil; + if (val.isInteger) + { + return val; + } + + return Value(val.doubleValue.ceil); } static wstring MID(wstring str, int i, int len) {