@@ -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 |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | abstract class ComplexNumber extends Number implements ComplexNumberInterface, ScaleInterface |
34 | 34 | { |
35 | 35 | |
36 | - protected ImmutableDecimal|ImmutableFraction $realPart; |
|
37 | - protected ImmutableDecimal|ImmutableFraction $imaginaryPart; |
|
36 | + protected ImmutableDecimal | ImmutableFraction $realPart; |
|
37 | + protected ImmutableDecimal | ImmutableFraction $imaginaryPart; |
|
38 | 38 | protected CartesianCoordinate $cachedCartesian; |
39 | 39 | protected PolarCoordinate $cachedPolar; |
40 | 40 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * @throws OptionalExit |
54 | 54 | */ |
55 | 55 | public function __construct( |
56 | - ImmutableDecimal|ImmutableFraction $realPart, |
|
57 | - ImmutableDecimal|ImmutableFraction $imaginaryPart, |
|
56 | + ImmutableDecimal | ImmutableFraction $realPart, |
|
57 | + ImmutableDecimal | ImmutableFraction $imaginaryPart, |
|
58 | 58 | ?int $scale = null, |
59 | 59 | NumberBase $base = NumberBase::Ten |
60 | 60 | ) |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | ); |
76 | 76 | |
77 | 77 | $this->cachedCartesian = $cartesian; |
78 | - $this->cachedPolar = $cartesian->asPolar($this->scale + $this->realPart->numberOfTotalDigits() + $this->imaginaryPart->numberOfTotalDigits()); |
|
78 | + $this->cachedPolar = $cartesian->asPolar($this->scale+$this->realPart->numberOfTotalDigits()+$this->imaginaryPart->numberOfTotalDigits()); |
|
79 | 79 | |
80 | 80 | parent::__construct(); |
81 | 81 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | /** |
116 | 116 | * @return ImmutableDecimal|ImmutableFraction |
117 | 117 | */ |
118 | - public function getRealPart(): ImmutableDecimal|ImmutableFraction |
|
118 | + public function getRealPart(): ImmutableDecimal | ImmutableFraction |
|
119 | 119 | { |
120 | 120 | return $this->realPart; |
121 | 121 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | /** |
124 | 124 | * @return ImmutableDecimal|ImmutableFraction |
125 | 125 | */ |
126 | - public function getImaginaryPart(): ImmutableDecimal|ImmutableFraction |
|
126 | + public function getImaginaryPart(): ImmutableDecimal | ImmutableFraction |
|
127 | 127 | { |
128 | 128 | return $this->imaginaryPart; |
129 | 129 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | /** |
156 | 156 | * @return ImmutableDecimal|ImmutableFraction |
157 | 157 | */ |
158 | - public function asReal(): ImmutableDecimal|ImmutableFraction |
|
158 | + public function asReal(): ImmutableDecimal | ImmutableFraction |
|
159 | 159 | { |
160 | 160 | return (new ImmutableDecimal($this->getAsBaseTenRealNumber(), $this->getScale()))->setMode($this->getMode()); |
161 | 161 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * |
166 | 166 | * @return bool |
167 | 167 | */ |
168 | - public function isEqual(string|int|float|Decimal|Fraction|ComplexNumber $value): bool |
|
168 | + public function isEqual(string | int | float | Decimal | Fraction | ComplexNumber $value): bool |
|
169 | 169 | { |
170 | 170 | if (is_int($value) || is_float($value)) { |
171 | 171 | return false; |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | * @throws IntegrityConstraint |
40 | 40 | */ |
41 | 41 | public function add( |
42 | - string|int|float|Decimal|Fraction|ComplexNumber $num |
|
43 | - ): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static |
|
42 | + string | int | float | Decimal | Fraction | ComplexNumber $num |
|
43 | + ): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static |
|
44 | 44 | { |
45 | 45 | |
46 | 46 | $scale = $this->getScale(); |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * @return MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static |
73 | 73 | */ |
74 | 74 | public function subtract( |
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 | $scale = $this->getScale(); |
79 | 79 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @throws IntegrityConstraint |
105 | 105 | */ |
106 | 106 | public function multiply( |
107 | - string|int|float|Decimal|Fraction|ComplexNumber $num |
|
108 | - ): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static |
|
107 | + string | int | float | Decimal | Fraction | ComplexNumber $num |
|
108 | + ): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static |
|
109 | 109 | { |
110 | 110 | $scale = $this->getScale(); |
111 | 111 | |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | * @throws IncompatibleObjectState |
159 | 159 | */ |
160 | 160 | public function divide( |
161 | - string|int|float|Decimal|Fraction|ComplexNumber $num, |
|
161 | + string | int | float | Decimal | Fraction | ComplexNumber $num, |
|
162 | 162 | ?int $scale = null |
163 | - ): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static |
|
163 | + ): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static |
|
164 | 164 | { |
165 | 165 | |
166 | 166 | $scale = $scale ?? $this->getScale(); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | [$thatRealPart, $thatImaginaryPart] = self::partSelector($thatNum, $thisNum, 1, $this->getMode()); |
171 | 171 | |
172 | 172 | if ($thatNum->isComplex()) { |
173 | - $intScale = $scale + 2; |
|
173 | + $intScale = $scale+2; |
|
174 | 174 | $denominator = $thatRealPart->roundToScale($intScale)->pow(2)->add($thatImaginaryPart->asReal()->roundToScale($intScale)->pow(2)); |
175 | 175 | |
176 | 176 | $partA = $thisRealPart->roundToScale($intScale)->multiply($thatRealPart->roundToScale($intScale)) |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | * @throws IntegrityConstraint |
212 | 212 | */ |
213 | 213 | public function pow( |
214 | - string|int|float|Decimal|Fraction|ComplexNumber $num, |
|
214 | + string | int | float | Decimal | Fraction | ComplexNumber $num, |
|
215 | 215 | ?int $scale = null |
216 | - ): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static |
|
216 | + ): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static |
|
217 | 217 | { |
218 | 218 | $scale = $scale ?? $this->getScale(); |
219 | 219 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | if ($thatNum->isReal() && $thatNum->isNatural() && $thatNum->isPositive()) { |
227 | 227 | $newValue = $thisNum; |
228 | 228 | |
229 | - for ($i=0;$thatNum->isGreaterThan($i);$i++) { |
|
229 | + for ($i = 0;$thatNum->isGreaterThan($i);$i++) { |
|
230 | 230 | $newValue = $newValue->multiply($thisNum); |
231 | 231 | } |
232 | 232 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function sqrt( |
274 | 274 | ?int $scale = null |
275 | - ): MutableDecimal|ImmutableDecimal|MutableComplexNumber|ImmutableComplexNumber|MutableFraction|ImmutableFraction|static |
|
275 | + ): MutableDecimal | ImmutableDecimal | MutableComplexNumber | ImmutableComplexNumber | MutableFraction | ImmutableFraction | static |
|
276 | 276 | { |
277 | 277 | |
278 | 278 | $scale = $scale ?? $this->getScale(); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function truncate( |
31 | 31 | int $decimals = 0 |
32 | - ): ImmutableComplexNumber|MutableComplexNumber|static |
|
32 | + ): ImmutableComplexNumber | MutableComplexNumber | static |
|
33 | 33 | { |
34 | 34 | $roundedReal = $this->realPart->truncate($decimals); |
35 | 35 | $roundedImaginary = $this->imaginaryPart->truncate($decimals); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * @return ImmutableComplexNumber|MutableComplexNumber|static |
42 | 42 | */ |
43 | - public function floor(): ImmutableComplexNumber|MutableComplexNumber|static |
|
43 | + public function floor(): ImmutableComplexNumber | MutableComplexNumber | static |
|
44 | 44 | { |
45 | 45 | return $this->round(0, RoundingMode::Floor); |
46 | 46 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * @return ImmutableComplexNumber|MutableComplexNumber|static |
50 | 50 | */ |
51 | - public function ceil(): ImmutableComplexNumber|MutableComplexNumber|static |
|
51 | + public function ceil(): ImmutableComplexNumber | MutableComplexNumber | static |
|
52 | 52 | { |
53 | 53 | return $this->round(0, RoundingMode::Ceil); |
54 | 54 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function truncateToScale( |
62 | 62 | int $scale |
63 | - ): ImmutableComplexNumber|MutableComplexNumber|static |
|
63 | + ): ImmutableComplexNumber | MutableComplexNumber | static |
|
64 | 64 | { |
65 | 65 | $roundedReal = $this->realPart->truncate($scale); |
66 | 66 | $roundedImaginary = $this->imaginaryPart->truncate($scale); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | public function round( |
77 | 77 | int $decimals = 0, |
78 | 78 | ?RoundingMode $mode = null |
79 | - ): ImmutableComplexNumber|MutableComplexNumber|static |
|
79 | + ): ImmutableComplexNumber | MutableComplexNumber | static |
|
80 | 80 | { |
81 | 81 | $roundedReal = $this->realPart->round($decimals, $mode); |
82 | 82 | $roundedImaginary = $this->imaginaryPart->round($decimals, $mode); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public function roundToScale( |
93 | 93 | int $scale, |
94 | 94 | ?RoundingMode $mode = null |
95 | - ): ImmutableComplexNumber|MutableComplexNumber|static |
|
95 | + ): ImmutableComplexNumber | MutableComplexNumber | static |
|
96 | 96 | { |
97 | 97 | $roundedReal = $this->realPart->round($scale, $mode); |
98 | 98 | $roundedImaginary = $this->imaginaryPart->round($scale, $mode); |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | * @return ImmutableComplexNumber|MutableComplexNumber|static |
108 | 108 | */ |
109 | 109 | abstract protected function setValue( |
110 | - ImmutableDecimal|ImmutableFraction $realPart, |
|
111 | - ImmutableDecimal|ImmutableFraction $imaginaryPart, |
|
110 | + ImmutableDecimal | ImmutableFraction $realPart, |
|
111 | + ImmutableDecimal | ImmutableFraction $imaginaryPart, |
|
112 | 112 | ?int $scale = null |
113 | - ): ImmutableComplexNumber|MutableComplexNumber|static; |
|
113 | + ): ImmutableComplexNumber | MutableComplexNumber | static; |
|
114 | 114 | |
115 | 115 | } |
116 | 116 | \ No newline at end of file |