From acad5af7552294690d65deac830ff84ea455a740 Mon Sep 17 00:00:00 2001 From: otya128 Date: Sat, 3 Sep 2016 17:55:48 +0900 Subject: [PATCH] =?UTF-8?q?LOG=E3=82=92=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SMILEBASIC/builtinfunctions.d | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/SMILEBASIC/builtinfunctions.d b/SMILEBASIC/builtinfunctions.d index 1f3596c..1663b19 100644 --- a/SMILEBASIC/builtinfunctions.d +++ b/SMILEBASIC/builtinfunctions.d @@ -1943,6 +1943,34 @@ class BuiltinFunction } return Value(a1.castDouble < a2.castDouble ? a1.castDouble : a2.castDouble); } + static pure nothrow @nogc @safe double EXP() + { + return std.math.E; + } + static pure nothrow @nogc @safe double EXP(double d) + { + return std.math.exp(d); + } + static double LOG(double a) + { + if (a <= 0) + { + throw new OutOfRange(); + } + return std.math.log(a); + } + static double LOG(double a, double b) + { + if (a <= 0) + { + throw new OutOfRange(); + } + if (b <= 1) + { + throw new OutOfRange(); + } + return std.math.log(a) / std.math.log(b); + } //alias void function(PetitComputer, Value[], Value[]) BuiltinFunc; static BuiltinFunctions[wstring] builtinFunctions; static wstring getBasicName(BFD)(const wstring def)