From 659e1d3c98d5f2f51a36cd7973a29644b496d0b0 Mon Sep 17 00:00:00 2001 From: otya128 Date: Wed, 7 Dec 2016 19:37:17 +0900 Subject: [PATCH] Implement CLASSIFY --- SMILEBASIC/builtinfunctions.d | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/SMILEBASIC/builtinfunctions.d b/SMILEBASIC/builtinfunctions.d index b51addf..b1e9307 100644 --- a/SMILEBASIC/builtinfunctions.d +++ b/SMILEBASIC/builtinfunctions.d @@ -203,6 +203,24 @@ class BuiltinFunction { return tanh(arg1); } + enum Classify + { + NORMAL = 0, + INFINITY = 1, + NAN = 2, + } + static pure nothrow int CLASSIFY(double arg) + { + if (arg.isNaN) + { + return Classify.NAN; + } + if (arg.isInfinity) + { + return Classify.INFINITY; + } + return Classify.NORMAL; + } static pure nothrow double RAD(double arg1) { return arg1 * std.math.PI / 180;