|
@@ 69-78 (lines=10) @@
|
| 66 |
|
* @param int $scale
|
| 67 |
|
* @return string
|
| 68 |
|
*/
|
| 69 |
|
public static function mul($leftOperand, $rightOperand, $scale = null)
|
| 70 |
|
{
|
| 71 |
|
$leftOperand = self::convertScientificNotationToString($leftOperand);
|
| 72 |
|
$rightOperand = self::convertScientificNotationToString($rightOperand);
|
| 73 |
|
|
| 74 |
|
if (null === $scale) {
|
| 75 |
|
return bcmul($leftOperand, $rightOperand);
|
| 76 |
|
}
|
| 77 |
|
return bcmul($leftOperand, $rightOperand, $scale);
|
| 78 |
|
}
|
| 79 |
|
|
| 80 |
|
/**
|
| 81 |
|
* @param string $leftOperand
|
|
@@ 86-95 (lines=10) @@
|
| 83 |
|
* @param int $scale
|
| 84 |
|
* @return string
|
| 85 |
|
*/
|
| 86 |
|
public static function pow($leftOperand, $rightOperand, $scale = null)
|
| 87 |
|
{
|
| 88 |
|
$leftOperand = self::convertScientificNotationToString($leftOperand);
|
| 89 |
|
$rightOperand = self::convertScientificNotationToString($rightOperand);
|
| 90 |
|
|
| 91 |
|
if (null === $scale) {
|
| 92 |
|
return bcpow($leftOperand, $rightOperand);
|
| 93 |
|
}
|
| 94 |
|
return bcpow($leftOperand, $rightOperand, $scale);
|
| 95 |
|
}
|
| 96 |
|
|
| 97 |
|
/**
|
| 98 |
|
* @param string $leftOperand
|
|
@@ 103-112 (lines=10) @@
|
| 100 |
|
* @param int $scale
|
| 101 |
|
* @return string
|
| 102 |
|
*/
|
| 103 |
|
public static function div($leftOperand, $rightOperand, $scale = null)
|
| 104 |
|
{
|
| 105 |
|
$leftOperand = self::convertScientificNotationToString($leftOperand);
|
| 106 |
|
$rightOperand = self::convertScientificNotationToString($rightOperand);
|
| 107 |
|
|
| 108 |
|
if (null === $scale) {
|
| 109 |
|
return bcdiv($leftOperand, $rightOperand);
|
| 110 |
|
}
|
| 111 |
|
return bcdiv($leftOperand, $rightOperand, $scale);
|
| 112 |
|
}
|
| 113 |
|
|
| 114 |
|
/**
|
| 115 |
|
* @param int|string $number
|
|
@@ 151-160 (lines=10) @@
|
| 148 |
|
* @param int $scale
|
| 149 |
|
* @return string
|
| 150 |
|
*/
|
| 151 |
|
public static function sub($leftOperand, $rightOperand, $scale = null)
|
| 152 |
|
{
|
| 153 |
|
$leftOperand = self::convertScientificNotationToString($leftOperand);
|
| 154 |
|
$rightOperand = self::convertScientificNotationToString($rightOperand);
|
| 155 |
|
|
| 156 |
|
if (null === $scale) {
|
| 157 |
|
return bcsub($leftOperand, $rightOperand);
|
| 158 |
|
}
|
| 159 |
|
return bcsub($leftOperand, $rightOperand, $scale);
|
| 160 |
|
}
|
| 161 |
|
|
| 162 |
|
/**
|
| 163 |
|
* @param string $leftOperand
|
|
@@ 168-177 (lines=10) @@
|
| 165 |
|
* @param int $scale
|
| 166 |
|
* @return string
|
| 167 |
|
*/
|
| 168 |
|
public static function add($leftOperand, $rightOperand, $scale = null)
|
| 169 |
|
{
|
| 170 |
|
$leftOperand = self::convertScientificNotationToString($leftOperand);
|
| 171 |
|
$rightOperand = self::convertScientificNotationToString($rightOperand);
|
| 172 |
|
|
| 173 |
|
if (null === $scale) {
|
| 174 |
|
return bcadd($leftOperand, $rightOperand);
|
| 175 |
|
}
|
| 176 |
|
return bcadd($leftOperand, $rightOperand, $scale);
|
| 177 |
|
}
|
| 178 |
|
|
| 179 |
|
/**
|
| 180 |
|
* @param int|string $number
|
|
@@ 421-430 (lines=10) @@
|
| 418 |
|
* @param int $scale
|
| 419 |
|
* @return string
|
| 420 |
|
*/
|
| 421 |
|
public static function powMod($leftOperand, $rightOperand, $modulus, $scale = null)
|
| 422 |
|
{
|
| 423 |
|
$leftOperand = self::convertScientificNotationToString($leftOperand);
|
| 424 |
|
$rightOperand = self::convertScientificNotationToString($rightOperand);
|
| 425 |
|
|
| 426 |
|
if (null === $scale) {
|
| 427 |
|
return bcpowmod($leftOperand, $rightOperand, $modulus);
|
| 428 |
|
}
|
| 429 |
|
return bcpowmod($leftOperand, $rightOperand, $modulus, $scale);
|
| 430 |
|
}
|
| 431 |
|
}
|
| 432 |
|
|