diff options
author | Jean-Michel Vedrine <vedrine@vedrine.org> | 2016-01-24 13:18:38 +0100 |
---|---|---|
committer | Jean-Michel Vedrine <vedrine@vedrine.org> | 2016-01-24 13:20:41 +0100 |
commit | e0abd45dc194f7ede2b460c6e9c2c303d4321bd7 (patch) | |
tree | ca54f942ddac9c4cce62db73a8ee90c074331590 /parser.php | |
parent | ab2016462cb7204f8e5e7fb6e5b9bdf1f4db68c6 (diff) |
Solve display using MathJax for all websites
Diffstat (limited to 'parser.php')
-rw-r--r-- | parser.php | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -1336,10 +1336,20 @@ class qtype_algebra_parser_bracket extends qtype_algebra_parser_term { * @return the numerical value of the term given the provided values for the variables */ function evaluate($params) { + if($this->_sign=='-') { + $mult=-1; + } else { + $mult=1; + } if(count($this->_arguments)!=$this->_nargs) { return 0; } - return $this->_arguments[0]->evaluate($params); + return $mult*$this->_arguments[0]->evaluate($params); + } + + function set_negative() { + // Set the sign to be a '-' + $this->_sign='-'; } /** |