aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/brick/math/src/Internal/Calculator/NativeCalculator.php')
-rw-r--r--vendor/brick/math/src/Internal/Calculator/NativeCalculator.php57
1 files changed, 2 insertions, 55 deletions
diff --git a/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php b/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php
index 020a6338b..7c679d24d 100644
--- a/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php
+++ b/vendor/brick/math/src/Internal/Calculator/NativeCalculator.php
@@ -19,17 +19,13 @@ class NativeCalculator extends Calculator
* The max number of digits the platform can natively add, subtract, multiply or divide without overflow.
* For multiplication, this represents the max sum of the lengths of both operands.
*
- * For addition, it is assumed that an extra digit can hold a carry (1) without overflowing.
+ * In addition, it is assumed that an extra digit can hold a carry (1) without overflowing.
* Example: 32-bit: max number 1,999,999,999 (9 digits + carry)
* 64-bit: max number 1,999,999,999,999,999,999 (18 digits + carry)
- *
- * @var int
*/
- private $maxDigits;
+ private int $maxDigits;
/**
- * Class constructor.
- *
* @codeCoverageIgnore
*/
public function __construct()
@@ -48,9 +44,6 @@ class NativeCalculator extends Calculator
}
}
- /**
- * {@inheritdoc}
- */
public function add(string $a, string $b) : string
{
/**
@@ -82,17 +75,11 @@ class NativeCalculator extends Calculator
return $result;
}
- /**
- * {@inheritdoc}
- */
public function sub(string $a, string $b) : string
{
return $this->add($a, $this->neg($b));
}
- /**
- * {@inheritdoc}
- */
public function mul(string $a, string $b) : string
{
/**
@@ -136,25 +123,16 @@ class NativeCalculator extends Calculator
return $result;
}
- /**
- * {@inheritdoc}
- */
public function divQ(string $a, string $b) : string
{
return $this->divQR($a, $b)[0];
}
- /**
- * {@inheritdoc}
- */
public function divR(string $a, string $b): string
{
return $this->divQR($a, $b)[1];
}
- /**
- * {@inheritdoc}
- */
public function divQR(string $a, string $b) : array
{
if ($a === '0') {
@@ -210,9 +188,6 @@ class NativeCalculator extends Calculator
return [$q, $r];
}
- /**
- * {@inheritdoc}
- */
public function pow(string $a, int $e) : string
{
if ($e === 0) {
@@ -240,8 +215,6 @@ class NativeCalculator extends Calculator
/**
* Algorithm from: https://www.geeksforgeeks.org/modular-exponentiation-power-in-modular-arithmetic/
- *
- * {@inheritdoc}
*/
public function modPow(string $base, string $exp, string $mod) : string
{
@@ -276,8 +249,6 @@ class NativeCalculator extends Calculator
/**
* Adapted from https://cp-algorithms.com/num_methods/roots_newton.html
- *
- * {@inheritDoc}
*/
public function sqrt(string $n) : string
{
@@ -306,11 +277,6 @@ class NativeCalculator extends Calculator
/**
* Performs the addition of two non-signed large integers.
- *
- * @param string $a The first operand.
- * @param string $b The second operand.
- *
- * @return string
*/
private function doAdd(string $a, string $b) : string
{
@@ -363,11 +329,6 @@ class NativeCalculator extends Calculator
/**
* Performs the subtraction of two non-signed large integers.
- *
- * @param string $a The first operand.
- * @param string $b The second operand.
- *
- * @return string
*/
private function doSub(string $a, string $b) : string
{
@@ -445,11 +406,6 @@ class NativeCalculator extends Calculator
/**
* Performs the multiplication of two non-signed large integers.
- *
- * @param string $a The first operand.
- * @param string $b The second operand.
- *
- * @return string
*/
private function doMul(string $a, string $b) : string
{
@@ -522,9 +478,6 @@ class NativeCalculator extends Calculator
/**
* Performs the division of two non-signed large integers.
*
- * @param string $a The first operand.
- * @param string $b The second operand.
- *
* @return string[] The quotient and remainder.
*/
private function doDiv(string $a, string $b) : array
@@ -583,9 +536,6 @@ class NativeCalculator extends Calculator
/**
* Compares two non-signed large numbers.
*
- * @param string $a The first operand.
- * @param string $b The second operand.
- *
* @return int [-1, 0, 1]
*/
private function doCmp(string $a, string $b) : int
@@ -607,9 +557,6 @@ class NativeCalculator extends Calculator
*
* The numbers must only consist of digits, without leading minus sign.
*
- * @param string $a The first operand.
- * @param string $b The second operand.
- *
* @return array{string, string, int}
*/
private function pad(string $a, string $b) : array