@@ -44,7 +44,7 @@ |
||
| 44 | 44 | public function asCartesian(?int $scale = null): CartesianCoordinate |
| 45 | 45 | { |
| 46 | 46 | $scale = $scale ?? 10; |
| 47 | - $intScale = $scale + 2; |
|
| 47 | + $intScale = $scale+2; |
|
| 48 | 48 | |
| 49 | 49 | if (is_null($this->cachedCartesian)) { |
| 50 | 50 | $x = $this->getAxis('rho')->multiply($this->getAxis('theta')->cos($intScale))->roundToScale($scale); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | public function getDistanceFromOrigin(?int $scale = null): ImmutableDecimal |
| 77 | 77 | { |
| 78 | 78 | $scale = $scale ?? 10; |
| 79 | - $intScale = $scale + 2; |
|
| 79 | + $intScale = $scale+2; |
|
| 80 | 80 | |
| 81 | 81 | $x = 0; |
| 82 | 82 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | public function distanceTo(CoordinateInterface $coordinate, ?int $scale = null): ImmutableDecimal |
| 106 | 106 | { |
| 107 | 107 | $scale = $scale ?? 10; |
| 108 | - $intScale = $scale + 2; |
|
| 108 | + $intScale = $scale+2; |
|
| 109 | 109 | |
| 110 | 110 | if (!($coordinate instanceof CartesianCoordinate)) { |
| 111 | 111 | $coordinate = $coordinate->asCartesian(); |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | public function asPolar(?int $scale = null): PolarCoordinate |
| 228 | 228 | { |
| 229 | 229 | $scale = $scale ?? 10; |
| 230 | - $intScale = $scale + 3; |
|
| 230 | + $intScale = $scale+3; |
|
| 231 | 231 | |
| 232 | 232 | if ($this->numberOfDimensions() !== 2) { |
| 233 | 233 | throw new IncompatibleObjectState( |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | /** |
| 114 | 114 | * @return ImmutableDecimal|ImmutableFraction |
| 115 | 115 | */ |
| 116 | - abstract public function asReal(): ImmutableDecimal|ImmutableFraction; |
|
| 116 | + abstract public function asReal(): ImmutableDecimal | ImmutableFraction; |
|
| 117 | 117 | |
| 118 | 118 | /** |
| 119 | 119 | * @return string |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $scale = ($this->getScale() > $num->getScale()) ? $this->getScale() : $num->getScale(); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - $scale = $scale + $this->numberOfLeadingZeros() + $num->numberOfLeadingZeros(); |
|
| 71 | + $scale = $scale+$this->numberOfLeadingZeros()+$num->numberOfLeadingZeros(); |
|
| 72 | 72 | |
| 73 | 73 | return ArithmeticProvider::divide($this->getAsBaseTenRealNumber(), $num->getAsBaseTenRealNumber(), $scale+1); |
| 74 | 74 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $scale = ($this->getScale() > $num->getScale()) ? $this->getScale() : $num->getScale(); |
| 86 | 86 | |
| 87 | - $scale += $this->numberOfDecimalDigits() + $num->numberOfDecimalDigits(); |
|
| 87 | + $scale += $this->numberOfDecimalDigits()+$num->numberOfDecimalDigits(); |
|
| 88 | 88 | |
| 89 | 89 | if ($this->isWhole() && $num->isPositive() && $num->isWhole() && $num->isLessThan(PHP_INT_MAX)) { |
| 90 | 90 | return gmp_strval(gmp_pow($this->getAsBaseTenRealNumber(), $num->asInt())); |
@@ -11,10 +11,10 @@ |
||
| 11 | 11 | { |
| 12 | 12 | |
| 13 | 13 | protected function setValue( |
| 14 | - ImmutableDecimal|ImmutableFraction $realPart, |
|
| 15 | - ImmutableDecimal|ImmutableFraction $imaginaryPart, |
|
| 14 | + ImmutableDecimal | ImmutableFraction $realPart, |
|
| 15 | + ImmutableDecimal | ImmutableFraction $imaginaryPart, |
|
| 16 | 16 | ?int $scale = null |
| 17 | - ): static|ImmutableComplexNumber |
|
| 17 | + ): static | ImmutableComplexNumber |
|
| 18 | 18 | { |
| 19 | 19 | $scale = $scale ?? $this->getScale(); |
| 20 | 20 | |
@@ -12,10 +12,10 @@ |
||
| 12 | 12 | { |
| 13 | 13 | |
| 14 | 14 | protected function setValue( |
| 15 | - ImmutableDecimal|ImmutableFraction $realPart, |
|
| 16 | - ImmutableDecimal|ImmutableFraction $imaginaryPart, |
|
| 15 | + ImmutableDecimal | ImmutableFraction $realPart, |
|
| 16 | + ImmutableDecimal | ImmutableFraction $imaginaryPart, |
|
| 17 | 17 | ?int $scale = null |
| 18 | - ): static|MutableComplexNumber |
|
| 18 | + ): static | MutableComplexNumber |
|
| 19 | 19 | { |
| 20 | 20 | $scale = $scale ?? $this->getScale(); |
| 21 | 21 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | ); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - $internalScale = $scale + 2; |
|
| 63 | + $internalScale = $scale+2; |
|
| 64 | 64 | |
| 65 | 65 | $e = Numbers::makeE($internalScale); |
| 66 | 66 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | ); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - $internalScale = $scale + 2; |
|
| 99 | + $internalScale = $scale+2; |
|
| 100 | 100 | |
| 101 | 101 | $e = Numbers::makeE($internalScale); |
| 102 | 102 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | ); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - $internalScale = $scale + 2; |
|
| 138 | + $internalScale = $scale+2; |
|
| 139 | 139 | |
| 140 | 140 | /** @var ImmutableDecimal $rangePdf */ |
| 141 | 141 | $rangePdf = |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * @return ImmutableFraction|MutableFraction|static |
| 165 | 165 | * @throws IntegrityConstraint |
| 166 | 166 | */ |
| 167 | - public function abs(): ImmutableFraction|MutableFraction|static |
|
| 167 | + public function abs(): ImmutableFraction | MutableFraction | static |
|
| 168 | 168 | { |
| 169 | 169 | if ($this->isPositive()) { |
| 170 | 170 | return $this; |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | /** |
| 251 | 251 | * @return ImmutableDecimal|ImmutableFraction |
| 252 | 252 | */ |
| 253 | - public function asReal(): ImmutableDecimal|ImmutableFraction |
|
| 253 | + public function asReal(): ImmutableDecimal | ImmutableFraction |
|
| 254 | 254 | { |
| 255 | 255 | return (new ImmutableFraction($this->getNumerator()->getAsBaseTenRealNumber(), $this->getDenominator()->getAsBaseTenRealNumber()))->setMode($this->getMode()); |
| 256 | 256 | } |
@@ -286,6 +286,6 @@ discard block |
||
| 286 | 286 | abstract protected function setValue( |
| 287 | 287 | ImmutableDecimal $numerator, |
| 288 | 288 | ImmutableDecimal $denominator |
| 289 | - ): MutableFraction|ImmutableFraction; |
|
| 289 | + ): MutableFraction | ImmutableFraction; |
|
| 290 | 290 | |
| 291 | 291 | } |
| 292 | 292 | \ No newline at end of file |
@@ -116,14 +116,14 @@ discard block |
||
| 116 | 116 | if ($exp > 0) { |
| 117 | 117 | $exp -= strlen($right); |
| 118 | 118 | if ($exp >= 0) { |
| 119 | - $right = str_pad($right, $exp - 1, '0').'.0'; |
|
| 119 | + $right = str_pad($right, $exp-1, '0').'.0'; |
|
| 120 | 120 | } else { |
| 121 | - $right = substr($right, 0, strlen($right) + abs($exp)).'.'.substr($right, strlen($right) + abs($exp) + 1); |
|
| 121 | + $right = substr($right, 0, strlen($right)+abs($exp)).'.'.substr($right, strlen($right)+abs($exp)+1); |
|
| 122 | 122 | } |
| 123 | 123 | } else { |
| 124 | 124 | $exp += strlen($left); |
| 125 | 125 | if ($exp >= 0) { |
| 126 | - $left = substr($left, 0, $exp).'.'.substr($left, $exp + 1); |
|
| 126 | + $left = substr($left, 0, $exp).'.'.substr($left, $exp+1); |
|
| 127 | 127 | } else { |
| 128 | 128 | $left = '0.'.str_pad($left, abs($exp)+1, '0', STR_PAD_LEFT); |
| 129 | 129 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | /** |
| 196 | 196 | * @return ImmutableDecimal|ImmutableFraction |
| 197 | 197 | */ |
| 198 | - public function asReal(): ImmutableDecimal|ImmutableFraction |
|
| 198 | + public function asReal(): ImmutableDecimal | ImmutableFraction |
|
| 199 | 199 | { |
| 200 | 200 | return (new ImmutableDecimal($this->getAsBaseTenRealNumber(), $this->getScale()))->setMode($this->getMode()); |
| 201 | 201 | } |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | * @param NumberBase $base |
| 270 | 270 | * @return DecimalInterface|NumberInterface |
| 271 | 271 | */ |
| 272 | - public function setBase(NumberBase $base): DecimalInterface|NumberInterface |
|
| 272 | + public function setBase(NumberBase $base): DecimalInterface | NumberInterface |
|
| 273 | 273 | { |
| 274 | 274 | $this->base = $base; |
| 275 | 275 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | * |
| 282 | 282 | * @return ImmutableDecimal|MutableDecimal |
| 283 | 283 | */ |
| 284 | - public function abs(): ImmutableDecimal|MutableDecimal |
|
| 284 | + public function abs(): ImmutableDecimal | MutableDecimal |
|
| 285 | 285 | { |
| 286 | 286 | $newValue = $this->absValue(); |
| 287 | 287 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | * @param DecimalInterface $num |
| 293 | 293 | * @return float|int |
| 294 | 294 | */ |
| 295 | - protected static function translateToNative(DecimalInterface $num): float|int |
|
| 295 | + protected static function translateToNative(DecimalInterface $num): float | int |
|
| 296 | 296 | { |
| 297 | 297 | return ($num->isInt() ? $num->asInt() : $num->asFloat()); |
| 298 | 298 | } |
@@ -350,13 +350,13 @@ discard block |
||
| 350 | 350 | ?int $scale = null, |
| 351 | 351 | ?NumberBase $base = null, |
| 352 | 352 | bool $setToNewBase = false |
| 353 | - ): ImmutableDecimal|MutableDecimal|static; |
|
| 353 | + ): ImmutableDecimal | MutableDecimal | static; |
|
| 354 | 354 | |
| 355 | 355 | /** |
| 356 | 356 | * @param NumberInterface|string|int|float $mod |
| 357 | 357 | * @return DecimalInterface |
| 358 | 358 | */ |
| 359 | - abstract public function continuousModulo(NumberInterface|string|int|float $mod): DecimalInterface; |
|
| 359 | + abstract public function continuousModulo(NumberInterface | string | int | float $mod): DecimalInterface; |
|
| 360 | 360 | |
| 361 | 361 | /** |
| 362 | 362 | * @param string $decimalPart |