BCMathCalculator
in package
implements
Calculator
Table of Contents
Interfaces
Constants
- CONVERSION_TABLE = ['0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', 'a' => '10', 'b' => '11', 'c' => '12', 'd' => '13', 'e' => '14', 'f' => '15']
- SCALE = 0
Methods
- add() : mixed
- Add numbers.
- baseConvert() : mixed
- Get the decimal integer value of a variable.
- compare() : int
- Number comparison.
- div() : mixed
- Divide numbers.
- mod() : mixed
- Returns the int point remainder (modulo) of the division of the arguments.
- multiply() : mixed
- Multiply numbers.
- pow() : mixed
- Raise an number to the power of exponent.
- sub() : mixed
- Subtract one number from another.
Constants
CONVERSION_TABLE
private
mixed
CONVERSION_TABLE
= ['0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', 'a' => '10', 'b' => '11', 'c' => '12', 'd' => '13', 'e' => '14', 'f' => '15']
SCALE
private
mixed
SCALE
= 0
Methods
add()
Add numbers.
public
add(mixed $value1, mixed $value2) : mixed
Parameters
- $value1 : mixed
-
a number that will be added to $value2
- $value2 : mixed
-
a number that will be added to $value1
Return values
mixed —the addition result
baseConvert()
Get the decimal integer value of a variable.
public
baseConvert(mixed $value, int $base) : mixed
Parameters
- $value : mixed
-
The scalar value being converted to an integer
- $base : int
Return values
mixed —the integer value
compare()
Number comparison.
public
compare(mixed $value1, mixed $value2) : int
Parameters
- $value1 : mixed
-
the first value
- $value2 : mixed
-
the second value
Return values
int —Returns < 0 if value1 is less than value2; > 0 if value1 is greater than value2, and 0 if they are equal.
div()
Divide numbers.
public
div(mixed $value, mixed $base) : mixed
Parameters
- $value : mixed
-
The number being divided.
- $base : mixed
-
The number that $value is being divided by.
Return values
mixed —the result of the division
mod()
Returns the int point remainder (modulo) of the division of the arguments.
public
mod(mixed $value, mixed $base) : mixed
Parameters
- $value : mixed
-
The dividend
- $base : mixed
-
The divisor
Return values
mixed —the remainder
multiply()
Multiply numbers.
public
multiply(mixed $value1, mixed $value2) : mixed
Parameters
- $value1 : mixed
-
a number that will be multiplied by $value2
- $value2 : mixed
-
a number that will be multiplied by $value1
Return values
mixed —the multiplication result
pow()
Raise an number to the power of exponent.
public
pow(mixed $value, int $exponent) : mixed
Parameters
- $value : mixed
-
scalar, the base to use
- $exponent : int
Return values
mixed —the value raised to the power of exp.
sub()
Subtract one number from another.
public
sub(mixed $value1, mixed $value2) : mixed
Parameters
- $value1 : mixed
-
a number that will be subtracted of $value2
- $value2 : mixed
-
a number that will be subtracted to $value1
Return values
mixed —the subtraction result