@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $this->base = $base; |
| 51 | 51 | |
| 52 | - $value = $value instanceof NumberInterface ? $value->getValue(NumberBase::Ten) : (string)$value; |
|
| 52 | + $value = $value instanceof NumberInterface ? $value->getValue(NumberBase::Ten) : (string) $value; |
|
| 53 | 53 | |
| 54 | 54 | if (str_contains($value, 'i')) { |
| 55 | 55 | $this->imaginary = true; |
@@ -107,14 +107,14 @@ discard block |
||
| 107 | 107 | if ($exp > 0) { |
| 108 | 108 | $exp -= strlen($right); |
| 109 | 109 | if ($exp >= 0) { |
| 110 | - $right = str_pad($right, $exp - 1, '0').'.0'; |
|
| 110 | + $right = str_pad($right, $exp-1, '0').'.0'; |
|
| 111 | 111 | } else { |
| 112 | - $right = substr($right, 0, strlen($right) + abs($exp)).'.'.substr($right, strlen($right) + abs($exp) + 1); |
|
| 112 | + $right = substr($right, 0, strlen($right)+abs($exp)).'.'.substr($right, strlen($right)+abs($exp)+1); |
|
| 113 | 113 | } |
| 114 | 114 | } else { |
| 115 | 115 | $exp += strlen($left); |
| 116 | 116 | if ($exp >= 0) { |
| 117 | - $left = substr($left, 0, $exp).'.'.substr($left, $exp + 1); |
|
| 117 | + $left = substr($left, 0, $exp).'.'.substr($left, $exp+1); |
|
| 118 | 118 | } else { |
| 119 | 119 | $left = '0.'.str_pad($left, abs($exp)+1, '0', STR_PAD_LEFT); |
| 120 | 120 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | * @param NumberBase $base |
| 260 | 260 | * @return DecimalInterface|NumberInterface |
| 261 | 261 | */ |
| 262 | - public function setBase(NumberBase $base): DecimalInterface|NumberInterface |
|
| 262 | + public function setBase(NumberBase $base): DecimalInterface | NumberInterface |
|
| 263 | 263 | { |
| 264 | 264 | $this->base = $base; |
| 265 | 265 | |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | * |
| 272 | 272 | * @return DecimalInterface|NumberInterface |
| 273 | 273 | */ |
| 274 | - public function abs(): DecimalInterface|NumberInterface |
|
| 274 | + public function abs(): DecimalInterface | NumberInterface |
|
| 275 | 275 | { |
| 276 | 276 | $newValue = $this->absValue(); |
| 277 | 277 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @param DecimalInterface $num |
| 283 | 283 | * @return float|int |
| 284 | 284 | */ |
| 285 | - protected static function translateToNative(DecimalInterface $num): float|int |
|
| 285 | + protected static function translateToNative(DecimalInterface $num): float | int |
|
| 286 | 286 | { |
| 287 | 287 | return ($num->isInt() ? $num->asInt() : $num->asFloat()); |
| 288 | 288 | } |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | * @param NumberInterface|string|int|float $mod |
| 342 | 342 | * @return DecimalInterface |
| 343 | 343 | */ |
| 344 | - abstract public function continuousModulo(NumberInterface|string|int|float $mod): DecimalInterface; |
|
| 344 | + abstract public function continuousModulo(NumberInterface | string | int | float $mod): DecimalInterface; |
|
| 345 | 345 | |
| 346 | 346 | /** |
| 347 | 347 | * @param string $decimalPart |
@@ -105,8 +105,8 @@ |
||
| 105 | 105 | $runningTotal = Numbers::make(Numbers::IMMUTABLE, $startVal->getAsBaseTenRealNumber()); |
| 106 | 106 | while ($runningTotal->isGreaterThan(0)) { |
| 107 | 107 | $current = gmp_div_qr($runningTotal->getAsBaseTenRealNumber(), $baseNum->getAsBaseTenRealNumber()); |
| 108 | - $mod = (int)$current[1]; |
|
| 109 | - $stringVal = self::$chars[$mod] . $stringVal; |
|
| 108 | + $mod = (int) $current[1]; |
|
| 109 | + $stringVal = self::$chars[$mod].$stringVal; |
|
| 110 | 110 | $runningTotal = Numbers::make(Numbers::IMMUTABLE, $current[0]); |
| 111 | 111 | } |
| 112 | 112 | } else { |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @return ImmutableDecimal|MutableDecimal|NumberInterface|ImmutableDecimal[]|MutableDecimal[]|NumberInterface[] |
| 115 | 115 | * @throws IntegrityConstraint |
| 116 | 116 | */ |
| 117 | - public static function makeOrDont(string|object $type, mixed $value, ?int $scale = null, NumberBase $base = NumberBase::Ten) |
|
| 117 | + public static function makeOrDont(string | object $type, mixed $value, ?int $scale = null, NumberBase $base = NumberBase::Ten) |
|
| 118 | 118 | {
|
| 119 | 119 | |
| 120 | 120 | if (is_object($value)) {
|
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | if ($scale > 100) {
|
| 239 | - $pi = self::make(self::IMMUTABLE, ConstantProvider::makePi($scale+2), $scale + 2); |
|
| 239 | + $pi = self::make(self::IMMUTABLE, ConstantProvider::makePi($scale+2), $scale+2); |
|
| 240 | 240 | /** @var ImmutableDecimal */ |
| 241 | 241 | return $pi->multiply(2)->truncateToScale($scale); |
| 242 | 242 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $total = strlen($fractional); |
| 148 | 148 | $fractional = ltrim($fractional, '0'); |
| 149 | 149 | |
| 150 | - return ($total - strlen($fractional)); |
|
| 150 | + return ($total-strlen($fractional)); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function numberOfTotalDigits(): int |
| 159 | 159 | { |
| 160 | - return $this->numberOfDecimalDigits() + $this->numberOfIntDigits(); |
|
| 160 | + return $this->numberOfDecimalDigits()+$this->numberOfIntDigits(); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | public function isFloat(): bool |
| 221 | 221 | { |
| 222 | 222 | |
| 223 | - return (bool)ArithmeticProvider::compare($this->getDecimalPart(), '0'); |
|
| 223 | + return (bool) ArithmeticProvider::compare($this->getDecimalPart(), '0'); |
|
| 224 | 224 | |
| 225 | 225 | } |
| 226 | 226 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | public function asFloat(): float |
| 231 | 231 | { |
| 232 | - return (float)$this->asReal(); |
|
| 232 | + return (float) $this->asReal(); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /** |