From d32a075e7a5ca21ec72dad9a6d54ddc31df01501 Mon Sep 17 00:00:00 2001 From: Charlie Brej Date: Wed, 8 Jul 2009 10:40:02 +0100 Subject: [PATCH] [script] Correct the math min and max functions Were the wrong way round and confusingly written. Also adds a MathPi constant. --- src/plugins/splash/script/script-lib-math.script | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/plugins/splash/script/script-lib-math.script b/src/plugins/splash/script/script-lib-math.script index c90bba04..d71b338b 100644 --- a/src/plugins/splash/script/script-lib-math.script +++ b/src/plugins/splash/script/script-lib-math.script @@ -3,14 +3,14 @@ fun MathAbs (value){ return value; } -fun MathMin (value, min){ - if (value < min) return min; - return value; +fun MathMin (value_a, value_b){ + if (value_a < value_b) return value_a; + return value_b; } fun MathMax (value, max){ - if (value > max) return max; - return value; + if (value_a > value_a) return value_a; + return value_b; } fun MathClamp (value, min, max){ @@ -18,3 +18,6 @@ fun MathClamp (value, min, max){ if (value > max) return max; return value; } + + +MathPi = 3.14159265358979323846;