MDL-27659 "have evalmath accept numbers expressed with scientific

notation"
This commit is contained in:
Jamie Pratt
2011-06-30 17:49:49 +01:00
committed by Tim Hunt
parent 4733133533
commit 9085134ed7
2 changed files with 19 additions and 1 deletions
+1 -1
View File
@@ -212,7 +212,7 @@ class EvalMath {
while(1) { // 1 Infinite Loop ;)
$op = substr($expr, $index, 1); // get the first character at the current index
// find out if we're currently at the beginning of a number/variable/function/parenthesis/operand
$ex = preg_match('/^('.self::$namepat.'\(?|\d+(?:\.\d*)?|\.\d+|\()/', substr($expr, $index), $match);
$ex = preg_match('/^('.self::$namepat.'\(?|\d+(?:\.\d*)?(?:(e[+-]?)\d*)?|\.\d+|\()/', substr($expr, $index), $match);
//===============
if ($op == '-' and !$expecting_op) { // is it a negation instead of a minus?
$stack->push('_'); // put a negation on the stack