@@ -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 |
@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * @return ImmutableDecimal|MutableDecimal|ImmutableComplexNumber|MutableComplexNumber|static |
| 19 | 19 | */ |
| 20 | - public function ceil(): ImmutableDecimal|MutableDecimal|ImmutableComplexNumber|MutableComplexNumber|static; |
|
| 20 | + public function ceil(): ImmutableDecimal | MutableDecimal | ImmutableComplexNumber | MutableComplexNumber | static; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @return ImmutableDecimal|MutableDecimal|ImmutableComplexNumber|MutableComplexNumber|static |
| 24 | 24 | */ |
| 25 | - public function floor(): ImmutableDecimal|MutableDecimal|ImmutableComplexNumber|MutableComplexNumber|static; |
|
| 25 | + public function floor(): ImmutableDecimal | MutableDecimal | ImmutableComplexNumber | MutableComplexNumber | static; |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @param int $decimals |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | public function round( |
| 33 | 33 | int $decimals = 0, |
| 34 | 34 | ?RoundingMode $mode = null |
| 35 | - ): ImmutableDecimal|MutableDecimal|ImmutableComplexNumber|MutableComplexNumber|static; |
|
| 35 | + ): ImmutableDecimal | MutableDecimal | ImmutableComplexNumber | MutableComplexNumber | static; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @param int $decimals |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function truncate( |
| 43 | 43 | int $decimals = 0 |
| 44 | - ): ImmutableDecimal|MutableDecimal|ImmutableComplexNumber|MutableComplexNumber|static; |
|
| 44 | + ): ImmutableDecimal | MutableDecimal | ImmutableComplexNumber | MutableComplexNumber | static; |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * @param int $scale |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | public function roundToScale( |
| 52 | 52 | int $scale, |
| 53 | 53 | ?RoundingMode $mode = null |
| 54 | - ): ImmutableDecimal|MutableDecimal|ImmutableComplexNumber|MutableComplexNumber|static; |
|
| 54 | + ): ImmutableDecimal | MutableDecimal | ImmutableComplexNumber | MutableComplexNumber | static; |
|
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * @param int $scale |
@@ -60,6 +60,6 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function truncateToScale( |
| 62 | 62 | int $scale |
| 63 | - ): ImmutableDecimal|MutableDecimal|ImmutableComplexNumber|MutableComplexNumber|static; |
|
| 63 | + ): ImmutableDecimal | MutableDecimal | ImmutableComplexNumber | MutableComplexNumber | static; |
|
| 64 | 64 | |
| 65 | 65 | } |
| 66 | 66 | \ No newline at end of file |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | /** |
| 22 | 22 | * @return MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|NumberInterface |
| 23 | 23 | */ |
| 24 | - public function abs(): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static; |
|
| 24 | + public function abs(): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * @return string |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | * @return MutableDecimal|ImmutableComplexNumber|MutableFraction|ImmutableDecimal|MutableComplexNumber|ImmutableFraction|NumberInterface |
| 35 | 35 | */ |
| 36 | 36 | public function add( |
| 37 | - string|int|float|Decimal|Fraction|ComplexNumber $num |
|
| 38 | - ): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static; |
|
| 37 | + string | int | float | Decimal | Fraction | ComplexNumber $num |
|
| 38 | + ): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static; |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * @param string|int|float|Decimal|Fraction|ComplexNumber $num |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | * @return MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|NumberInterface |
| 44 | 44 | */ |
| 45 | 45 | public function subtract( |
| 46 | - string|int|float|Decimal|Fraction|ComplexNumber $num |
|
| 47 | - ): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static; |
|
| 46 | + string | int | float | Decimal | Fraction | ComplexNumber $num |
|
| 47 | + ): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static; |
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * @param string|int|float|Decimal|Fraction|ComplexNumber $num |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | * @return MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|NumberInterface |
| 53 | 53 | */ |
| 54 | 54 | public function multiply( |
| 55 | - string|int|float|Decimal|Fraction|ComplexNumber $num |
|
| 56 | - ): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static; |
|
| 55 | + string | int | float | Decimal | Fraction | ComplexNumber $num |
|
| 56 | + ): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static; |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * @param string|int|float|Decimal|Fraction|ComplexNumber $num |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | * @return MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|NumberInterface |
| 63 | 63 | */ |
| 64 | 64 | public function divide( |
| 65 | - string|int|float|Decimal|Fraction|ComplexNumber $num, |
|
| 65 | + string | int | float | Decimal | Fraction | ComplexNumber $num, |
|
| 66 | 66 | ?int $scale = null |
| 67 | - ): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static; |
|
| 67 | + ): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static; |
|
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * @param string|int|float|Decimal|Fraction|ComplexNumber $num |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | * @return MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|NumberInterface |
| 73 | 73 | */ |
| 74 | 74 | public function pow( |
| 75 | - string|int|float|Decimal|Fraction|ComplexNumber $num |
|
| 76 | - ): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static; |
|
| 75 | + string | int | float | Decimal | Fraction | ComplexNumber $num |
|
| 76 | + ): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static; |
|
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * @param int|null $scale |
@@ -81,14 +81,14 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function sqrt( |
| 83 | 83 | ?int $scale = null |
| 84 | - ): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static; |
|
| 84 | + ): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static; |
|
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * @param string|int|float|Decimal|Fraction|ComplexNumber $value |
| 88 | 88 | * |
| 89 | 89 | * @return bool |
| 90 | 90 | */ |
| 91 | - public function isEqual(string|int|float|Decimal|Fraction|ComplexNumber $value): bool; |
|
| 91 | + public function isEqual(string | int | float | Decimal | Fraction | ComplexNumber $value): bool; |
|
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * @return int|null |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | /** |
| 109 | 109 | * @return ImmutableDecimal|ImmutableFraction |
| 110 | 110 | */ |
| 111 | - public function asReal(): ImmutableDecimal|ImmutableFraction; |
|
| 111 | + public function asReal(): ImmutableDecimal | ImmutableFraction; |
|
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | 114 | * @return bool |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | * @throws IntegrityConstraint |
| 35 | 35 | */ |
| 36 | 36 | protected function helperAddSub( |
| 37 | - ImmutableDecimal|ImmutableFraction|ImmutableComplexNumber $thisNum, |
|
| 38 | - ImmutableDecimal|ImmutableFraction|ImmutableComplexNumber $thatNum, |
|
| 37 | + ImmutableDecimal | ImmutableFraction | ImmutableComplexNumber $thisNum, |
|
| 38 | + ImmutableDecimal | ImmutableFraction | ImmutableComplexNumber $thatNum, |
|
| 39 | 39 | CalcOperation $operation |
| 40 | - ): static|ImmutableComplexNumber|ImmutableDecimal|MutableDecimal|ImmutableFraction|MutableFraction |
|
| 40 | + ): static | ImmutableComplexNumber | ImmutableDecimal | MutableDecimal | ImmutableFraction | MutableFraction |
|
| 41 | 41 | { |
| 42 | 42 | if ($thatNum->isEqual(0)) { |
| 43 | 43 | return $this; |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | * @throws IntegrityConstraint |
| 81 | 81 | */ |
| 82 | 82 | protected function helperAddSubXor( |
| 83 | - ImmutableDecimal|ImmutableFraction|ImmutableComplexNumber $thisNum, |
|
| 84 | - ImmutableDecimal|ImmutableFraction|ImmutableComplexNumber $thatNum, |
|
| 83 | + ImmutableDecimal | ImmutableFraction | ImmutableComplexNumber $thisNum, |
|
| 84 | + ImmutableDecimal | ImmutableFraction | ImmutableComplexNumber $thatNum, |
|
| 85 | 85 | CalcOperation $operation |
| 86 | - ): static|ImmutableComplexNumber |
|
| 86 | + ): static | ImmutableComplexNumber |
|
| 87 | 87 | { |
| 88 | 88 | [$thisRealPart, $thisImaginaryPart] = static::partSelector($thisNum, $thatNum, 0, $this->getMode()); |
| 89 | 89 | [$thatRealPart, $thatImaginaryPart] = static::partSelector($thatNum, $thisNum, 0, $this->getMode()); |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | * @throws MissingPackage |
| 130 | 130 | */ |
| 131 | 131 | protected function helperAddSubFraction( |
| 132 | - ImmutableDecimal|ImmutableFraction $num, |
|
| 132 | + ImmutableDecimal | ImmutableFraction $num, |
|
| 133 | 133 | CalcOperation $operation |
| 134 | - ): ImmutableFraction|MutableFraction |
|
| 134 | + ): ImmutableFraction | MutableFraction |
|
| 135 | 135 | { |
| 136 | 136 | if ($num instanceof FractionInterface && $this->getDenominator()->isEqual($num->getDenominator())) { |
| 137 | 137 | $finalDenominator = $this->getDenominator(); |
@@ -184,11 +184,11 @@ discard block |
||
| 184 | 184 | * @return ImmutableComplexNumber|static |
| 185 | 185 | */ |
| 186 | 186 | public function helperMulDiv( |
| 187 | - ImmutableDecimal|ImmutableFraction|ImmutableComplexNumber $thisNum, |
|
| 188 | - ImmutableDecimal|ImmutableFraction|ImmutableComplexNumber $thatNum, |
|
| 187 | + ImmutableDecimal | ImmutableFraction | ImmutableComplexNumber $thisNum, |
|
| 188 | + ImmutableDecimal | ImmutableFraction | ImmutableComplexNumber $thatNum, |
|
| 189 | 189 | CalcOperation $operation, |
| 190 | 190 | int $scale |
| 191 | - ): static|ImmutableComplexNumber |
|
| 191 | + ): static | ImmutableComplexNumber |
|
| 192 | 192 | { |
| 193 | 193 | if ($thatNum->isEqual(1)) { |
| 194 | 194 | return $this; |
@@ -232,11 +232,11 @@ discard block |
||
| 232 | 232 | * @throws IntegrityConstraint |
| 233 | 233 | */ |
| 234 | 234 | public function helperMulDivFraction( |
| 235 | - ImmutableDecimal|ImmutableFraction|ImmutableComplexNumber $thisNum, |
|
| 236 | - ImmutableDecimal|ImmutableFraction|ImmutableComplexNumber $thatNum, |
|
| 235 | + ImmutableDecimal | ImmutableFraction | ImmutableComplexNumber $thisNum, |
|
| 236 | + ImmutableDecimal | ImmutableFraction | ImmutableComplexNumber $thatNum, |
|
| 237 | 237 | CalcOperation $operation, |
| 238 | 238 | int $scale |
| 239 | - ): static|ImmutableComplexNumber |
|
| 239 | + ): static | ImmutableComplexNumber |
|
| 240 | 240 | { |
| 241 | 241 | if ($thatNum instanceof ImmutableFraction) { |
| 242 | 242 | $mulNumerator = match ($operation) { |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | * @throws MissingPackage |
| 44 | 44 | */ |
| 45 | 45 | public function add( |
| 46 | - string|int|float|Decimal|Fraction|ComplexNumber $num |
|
| 47 | - ): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static |
|
| 46 | + string | int | float | Decimal | Fraction | ComplexNumber $num |
|
| 47 | + ): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static |
|
| 48 | 48 | { |
| 49 | 49 | [$thisNum, $thatNum] = $this->translateToObjects($num); |
| 50 | 50 | |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | * @throws MissingPackage |
| 63 | 63 | */ |
| 64 | 64 | public function subtract( |
| 65 | - string|int|float|Decimal|Fraction|ComplexNumber $num |
|
| 66 | - ): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static |
|
| 65 | + string | int | float | Decimal | Fraction | ComplexNumber $num |
|
| 66 | + ): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static |
|
| 67 | 67 | { |
| 68 | 68 | [$thisNum, $thatNum] = $this->translateToObjects($num); |
| 69 | 69 | |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | * @throws IntegrityConstraint |
| 81 | 81 | */ |
| 82 | 82 | public function multiply( |
| 83 | - string|int|float|Decimal|Fraction|ComplexNumber $num |
|
| 84 | - ): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static |
|
| 83 | + string | int | float | Decimal | Fraction | ComplexNumber $num |
|
| 84 | + ): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static |
|
| 85 | 85 | { |
| 86 | 86 | [$thisNum, $thatNum] = $this->translateToObjects($num); |
| 87 | 87 | |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | * @throws IncompatibleObjectState |
| 101 | 101 | */ |
| 102 | 102 | public function divide( |
| 103 | - string|int|float|Decimal|Fraction|ComplexNumber $num, |
|
| 103 | + string | int | float | Decimal | Fraction | ComplexNumber $num, |
|
| 104 | 104 | ?int $scale = null |
| 105 | - ): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static |
|
| 105 | + ): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static |
|
| 106 | 106 | { |
| 107 | 107 | |
| 108 | 108 | $scale = $scale ?? $this->getScale(); |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | * @throws IntegrityConstraint |
| 134 | 134 | */ |
| 135 | 135 | public function pow( |
| 136 | - string|int|float|Decimal|Fraction|ComplexNumber $num |
|
| 137 | - ): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static |
|
| 136 | + string | int | float | Decimal | Fraction | ComplexNumber $num |
|
| 137 | + ): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static |
|
| 138 | 138 | { |
| 139 | 139 | [$thisNum, $thatNum] = $this->translateToObjects($num); |
| 140 | 140 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | public function sqrt( |
| 193 | 193 | ?int $scale = null |
| 194 | - ): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static |
|
| 194 | + ): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static |
|
| 195 | 195 | { |
| 196 | 196 | $scale = is_null($scale) ? $this->getScale() : $scale; |
| 197 | 197 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | public function round( |
| 43 | 43 | int $decimals = 0, |
| 44 | 44 | ?RoundingMode $mode = null |
| 45 | - ): ImmutableDecimal|MutableDecimal|static |
|
| 45 | + ): ImmutableDecimal | MutableDecimal | static |
|
| 46 | 46 | { |
| 47 | 47 | if ($this->getValue(NumberBase::Ten) == Number::INFINITY || $this->getValue(NumberBase::Ten) == Number::NEG_INFINITY) { |
| 48 | 48 | return $this; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function truncate( |
| 69 | 69 | int $decimals = 0 |
| 70 | - ): ImmutableDecimal|MutableDecimal|static |
|
| 70 | + ): ImmutableDecimal | MutableDecimal | static |
|
| 71 | 71 | { |
| 72 | 72 | if ($this->getValue(NumberBase::Ten) == Number::INFINITY || $this->getValue(NumberBase::Ten) == Number::NEG_INFINITY) { |
| 73 | 73 | return $this; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | public function roundToScale( |
| 112 | 112 | int $scale, |
| 113 | 113 | ?RoundingMode $mode = null |
| 114 | - ): ImmutableDecimal|MutableDecimal|static |
|
| 114 | + ): ImmutableDecimal | MutableDecimal | static |
|
| 115 | 115 | { |
| 116 | 116 | |
| 117 | 117 | $this->scale = $scale; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function truncateToScale( |
| 129 | 129 | int $scale |
| 130 | - ): ImmutableDecimal|MutableDecimal|static |
|
| 130 | + ): ImmutableDecimal | MutableDecimal | static |
|
| 131 | 131 | { |
| 132 | 132 | |
| 133 | 133 | $this->scale = $scale; |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * @return ImmutableDecimal|MutableDecimal|static |
| 141 | 141 | * @throws IntegrityConstraint |
| 142 | 142 | */ |
| 143 | - public function ceil(): ImmutableDecimal|MutableDecimal|static |
|
| 143 | + public function ceil(): ImmutableDecimal | MutableDecimal | static |
|
| 144 | 144 | { |
| 145 | 145 | return $this->round(0, RoundingMode::Ceil); |
| 146 | 146 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * @return ImmutableDecimal|MutableDecimal|static |
| 150 | 150 | * @throws IntegrityConstraint |
| 151 | 151 | */ |
| 152 | - public function floor(): ImmutableDecimal|MutableDecimal|static |
|
| 152 | + public function floor(): ImmutableDecimal | MutableDecimal | static |
|
| 153 | 153 | { |
| 154 | 154 | return $this->round(0, RoundingMode::Floor); |
| 155 | 155 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $total = strlen($fractional); |
| 167 | 167 | $fractional = ltrim($fractional, '0'); |
| 168 | 168 | |
| 169 | - return ($total - strlen($fractional)); |
|
| 169 | + return ($total-strlen($fractional)); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public function numberOfTotalDigits(): int |
| 178 | 178 | { |
| 179 | - return $this->numberOfDecimalDigits() + $this->numberOfIntDigits(); |
|
| 179 | + return $this->numberOfDecimalDigits()+$this->numberOfIntDigits(); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | /** |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | } elseif ($this->isEqual(0)) { |
| 45 | 45 | $answer = Numbers::makeZero(); |
| 46 | 46 | } else { |
| 47 | - $intScale = $scale + 2; |
|
| 47 | + $intScale = $scale+2; |
|
| 48 | 48 | $num = new ImmutableDecimal($this->getValue(NumberBase::Ten), $intScale); |
| 49 | 49 | |
| 50 | 50 | $answer = $this->helperArcsinGCF($num, $intScale); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | } elseif ($this->isEqual(1)) { |
| 75 | 75 | $answer = Numbers::makeZero(); |
| 76 | 76 | } else { |
| 77 | - $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $scale + 2); |
|
| 77 | + $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $scale+2); |
|
| 78 | 78 | |
| 79 | 79 | $answer = $piDivTwo->subtract($z->arcsin($scale+2)); |
| 80 | 80 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | protected function arctanScale(int $scale = null): string |
| 93 | 93 | { |
| 94 | - $intScale = ($scale ?? $this->getScale()) + 2; |
|
| 94 | + $intScale = ($scale ?? $this->getScale())+2; |
|
| 95 | 95 | |
| 96 | 96 | $thisNum = Numbers::makeOrDont(Numbers::IMMUTABLE, $this->absValue()); |
| 97 | 97 | |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | $scale = $scale ?? $this->getScale(); |
| 130 | 130 | |
| 131 | - $piDivTwo = Numbers::makePi($scale + 2)->divide(2, $scale + 2); |
|
| 131 | + $piDivTwo = Numbers::makePi($scale+2)->divide(2, $scale+2); |
|
| 132 | 132 | |
| 133 | - $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this->absValue(), $scale + 2); |
|
| 133 | + $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this->absValue(), $scale+2); |
|
| 134 | 134 | |
| 135 | 135 | $arctan = $z->arctan($scale+2, false); |
| 136 | 136 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | { |
| 154 | 154 | |
| 155 | 155 | $scale = $scale ?? $this->getScale(); |
| 156 | - $intScale = $scale + 2; |
|
| 156 | + $intScale = $scale+2; |
|
| 157 | 157 | |
| 158 | 158 | $one = Numbers::makeOne($intScale); |
| 159 | 159 | $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this->absValue(), $intScale); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $answer = SeriesProvider::generalizedContinuedFraction( |
| 210 | 210 | $aPart, |
| 211 | 211 | $bPart, |
| 212 | - $intScale * 2, |
|
| 212 | + $intScale*2, |
|
| 213 | 213 | $intScale, |
| 214 | 214 | SeriesProvider::SUM_MODE_SUB |
| 215 | 215 | ); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | { |
| 233 | 233 | |
| 234 | 234 | $scale = $scale ?? $this->getScale(); |
| 235 | - $intScale = $scale + 2; |
|
| 235 | + $intScale = $scale+2; |
|
| 236 | 236 | |
| 237 | 237 | $one = Numbers::makeOne($intScale); |
| 238 | 238 | $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $intScale); |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | $answer = SeriesProvider::generalizedContinuedFraction( |
| 288 | 288 | $aPart, |
| 289 | 289 | $bPart, |
| 290 | - $intScale * 2, |
|
| 290 | + $intScale*2, |
|
| 291 | 291 | $intScale, |
| 292 | 292 | SeriesProvider::SUM_MODE_ALT_FIRST_ADD |
| 293 | 293 | ); |
@@ -301,13 +301,13 @@ discard block |
||
| 301 | 301 | * @param RoundingMode|null $mode |
| 302 | 302 | * @return ImmutableDecimal|MutableDecimal|static |
| 303 | 303 | */ |
| 304 | - abstract public function roundToScale(int $scale, ?RoundingMode $mode = null): ImmutableDecimal|MutableDecimal|static; |
|
| 304 | + abstract public function roundToScale(int $scale, ?RoundingMode $mode = null): ImmutableDecimal | MutableDecimal | static; |
|
| 305 | 305 | |
| 306 | 306 | /** |
| 307 | 307 | * @param int $scale |
| 308 | 308 | * @return ImmutableDecimal|MutableDecimal|static |
| 309 | 309 | */ |
| 310 | - abstract public function truncateToScale(int $scale): ImmutableDecimal|MutableDecimal|static; |
|
| 310 | + abstract public function truncateToScale(int $scale): ImmutableDecimal | MutableDecimal | static; |
|
| 311 | 311 | |
| 312 | 312 | /** |
| 313 | 313 | * @return int|null |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | * @throws IntegrityConstraint |
| 37 | 37 | */ |
| 38 | 38 | protected static function partSelector( |
| 39 | - ImmutableDecimal|ImmutableFraction|ImmutableComplexNumber $partThis, |
|
| 40 | - ImmutableDecimal|ImmutableFraction|ImmutableComplexNumber $compareTo, |
|
| 39 | + ImmutableDecimal | ImmutableFraction | ImmutableComplexNumber $partThis, |
|
| 40 | + ImmutableDecimal | ImmutableFraction | ImmutableComplexNumber $compareTo, |
|
| 41 | 41 | int $identity, |
| 42 | 42 | ?CalcMode $mode |
| 43 | 43 | ): array |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * @return ImmutableComplexNumber|ImmutableDecimal|ImmutableFraction |
| 109 | 109 | * @throws IntegrityConstraint |
| 110 | 110 | */ |
| 111 | - protected static function stringSelector(string $input, ?CalcMode $mode): ImmutableComplexNumber|ImmutableDecimal|ImmutableFraction |
|
| 111 | + protected static function stringSelector(string $input, ?CalcMode $mode): ImmutableComplexNumber | ImmutableDecimal | ImmutableFraction |
|
| 112 | 112 | { |
| 113 | 113 | |
| 114 | 114 | $input = trim($input); |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | * @throws IncompatibleObjectState |
| 133 | 133 | */ |
| 134 | 134 | protected static function normalizeObject( |
| 135 | - Fraction|Decimal|ComplexNumber $object, |
|
| 135 | + Fraction | Decimal | ComplexNumber $object, |
|
| 136 | 136 | ?CalcMode $mode |
| 137 | - ): ImmutableDecimal|ImmutableFraction|ImmutableComplexNumber |
|
| 137 | + ): ImmutableDecimal | ImmutableFraction | ImmutableComplexNumber |
|
| 138 | 138 | { |
| 139 | 139 | return match (true) { |
| 140 | 140 | $object instanceof Fraction => (new ImmutableFraction( |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @return ImmutableFraction[]|ImmutableDecimal[]|ImmutableComplexNumber[] |
| 181 | 181 | * @throws IntegrityConstraint |
| 182 | 182 | */ |
| 183 | - protected function translateToObjects(string|int|float|Decimal|Fraction|ComplexNumber $right): array |
|
| 183 | + protected function translateToObjects(string | int | float | Decimal | Fraction | ComplexNumber $right): array |
|
| 184 | 184 | { |
| 185 | 185 | $normalizedLeft = self::normalizeObject($this, $this->getMode()); |
| 186 | 186 | |