1 Description of EvalMath library import into Moodle
4 * implicit multiplication (optionally) not allowed
5 * new custom calc emulation functions
6 * removed (optionally) e and pi constants - not used in calc
8 * Fix a == FALSE that should have been === FALSE.
9 * added $expecting_op = true; for branch where a function with no operands is found to fix bug.
10 * moved pattern for func and var names into a static var
11 * made a function to test a string to see if it is a valid func or var name.
13 * added round, ceil and floor functions.
14 * EvalMath::EvalMath() changed to EvalMath::__construct() and there is a new EvalMath::EvalMath
15 function to maintain backwards compatibility
16 * Ensure a string is passed to preg_match in EvalMath::nfx.
18 To see all changes diff against version 1.1, available from:
19 http://www.phpclasses.org/browse/package/2695.html
23 Changes by Juan Pablo de Castro (MDL-14274):
24 * operators >,<,>=,<=,== added.
25 * function if[thenelse](condition, true_value, false_value)
27 Changes by Stefan Erlachner, Thomas Niedermaier (MDL-64414):
29 e.g. if (or(condition_1, condition_2, ... condition_n))
31 e.g. if (and(condition_1, condition_2, ... condition_n))
33 Changes by Raquel Ortega (MDL-76413)
34 * Avoid PHP 8.2: Partially-supported callable deprecations
35 * eg: call_user_func_array(array('self', 'sum'), $args to call_user_func_array(array(self::class, 'sum'), $args)
37 Changes by Meirza (MDL-75464)
38 * EvalMath has unit tests in lib/tests/mathslib_test.php,
39 since version 1.0.1, there are two additional tests:
40 - shouldSupportModuloOperator()
41 - shouldConsiderDoubleMinusAsPlus()
42 To pass the test, some modifications must be made:
43 - Adjust the test code so it can run properly by using \calc_formula.
44 Please see the differences between the code in MDL-75464 and the upstream code.
45 - In the dataprovider for both tests, add the formula in the first array with "=" at the first character.