From 190b3efb98cbad80a71cc00697497448a865b2df Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 23 Feb 2016 09:09:47 +0100 Subject: [PATCH] CustomVariableNumber: add a hint for floats --- library/Director/CustomVariable/CustomVariableNumber.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/library/Director/CustomVariable/CustomVariableNumber.php b/library/Director/CustomVariable/CustomVariableNumber.php index e04632ea..91a7b5a0 100644 --- a/library/Director/CustomVariable/CustomVariableNumber.php +++ b/library/Director/CustomVariable/CustomVariableNumber.php @@ -12,6 +12,15 @@ class CustomVariableNumber extends CustomVariable return false; } + // TODO: in case we encounter problems with floats we could + // consider something as follows, but taking more care + // about precision: + /* + if (is_float($this->value)) { + return sprintf($var->getValue(), '%.9F') + === sprintf($this->getValue(), '%.9F'); + } + */ return $var->getValue() === $this->getValue(); }