aboutsummaryrefslogtreecommitdiff
path: root/parser.php
diff options
context:
space:
mode:
authorJean-Michel Vedrine <vedrine@vedrine.org>2016-01-24 13:18:38 +0100
committerJean-Michel Vedrine <vedrine@vedrine.org>2016-01-24 13:20:41 +0100
commite0abd45dc194f7ede2b460c6e9c2c303d4321bd7 (patch)
treeca54f942ddac9c4cce62db73a8ee90c074331590 /parser.php
parentab2016462cb7204f8e5e7fb6e5b9bdf1f4db68c6 (diff)
Solve display using MathJax for all websites
Diffstat (limited to 'parser.php')
-rw-r--r--parser.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/parser.php b/parser.php
index 6a81fe6..8a21bc3 100644
--- a/parser.php
+++ b/parser.php
@@ -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='-';
}
/**