4 require_once
'Services/Math/classes/class.ilMathBaseAdapter.php';
15 public function add($left_operand, $right_operand, $scale = null)
25 public function sub($left_operand, $right_operand, $scale = null)
35 public function mul($left_operand, $right_operand, $scale = null)
42 if (strpos($e->getMessage(),
'A non-numeric value encountered') !==
false) {
49 return $multiplication;
55 public function div($left_operand, $right_operand, $scale = null)
57 if ($right_operand == 0) {
58 require_once
'Services/Math/exceptions/class.ilMathDivisionByZeroException.php';
68 if (strpos($e->getMessage(),
'A non-numeric value encountered') !==
false) {
81 public function mod($left_operand, $right_operand)
83 if ($right_operand == 0) {
84 require_once
'Services/Math/exceptions/class.ilMathDivisionByZeroException.php';
96 public function pow($left_operand, $right_operand, $scale = null)
106 public function sqrt($operand, $scale = null)
116 public function comp($left_operand, $right_operand, $scale = null)
118 $left_operand = $this->
normalize($left_operand);
119 $right_operand = $this->
normalize($right_operand);
122 if (is_numeric($scale)) {
123 $left_operand = $this->
applyScale($left_operand, $scale);
124 $right_operand = $this->
applyScale($right_operand, $scale);
127 if ($left_operand == $right_operand) {
129 } elseif ($left_operand > $right_operand) {
add($left_operand, $right_operand, $scale=null)
{Adds two numbers.mixed}
mod($left_operand, $right_operand)
{Gets modulus of two numbers.mixed }
mul($left_operand, $right_operand, $scale=null)
{Multiplies two numbers.mixed}
applyScale($number, $scale=null)
This method adapts the behaviour of bcscale()
normalize($number)
This function fixes problems which occur when locale ist set to de_DE for example, because bc* function expecting strings.
sqrt($operand, $scale=null)
{Gets the square root of a number.mixed}
foreach($_POST as $key=> $value) $res
pow($left_operand, $right_operand, $scale=null)
{Raises a number to another.mixed}
sub($left_operand, $right_operand, $scale=null)
{Subtracts two numbers.mixed}
comp($left_operand, $right_operand, $scale=null)
{Compares two numbers.mixed}
div($left_operand, $right_operand, $scale=null)
{Divides two numbers.mixed }