@@ -69,7 +69,7 @@ |
||
69 | 69 | * |
70 | 70 | * @return bool |
71 | 71 | */ |
72 | - public function isEqual(NumberInterface|int|string|float $value): bool; |
|
72 | + public function isEqual(NumberInterface | int | string | float $value): bool; |
|
73 | 73 | |
74 | 74 | /** |
75 | 75 | * @return int|null |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * |
25 | 25 | * @return DecimalInterface |
26 | 26 | */ |
27 | - public function continuousModulo(NumberInterface|string|int|float $mod): DecimalInterface; |
|
27 | + public function continuousModulo(NumberInterface | string | int | float $mod): DecimalInterface; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * @param $num |
@@ -68,7 +68,7 @@ |
||
68 | 68 | $thisNum = self::translateToNative($this); |
69 | 69 | $piDiv2 = M_PI_2; |
70 | 70 | |
71 | - return $piDiv2 - atan($thisNum); |
|
71 | + return $piDiv2-atan($thisNum); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | } |
75 | 75 | \ No newline at end of file |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * @param DecimalInterface $num |
16 | 16 | * @return float|int |
17 | 17 | */ |
18 | - abstract protected static function translateToNative(DecimalInterface $num): float|int; |
|
18 | + abstract protected static function translateToNative(DecimalInterface $num): float | int; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @return float |
@@ -41,7 +41,7 @@ |
||
41 | 41 | * @return bool |
42 | 42 | * @throws IntegrityConstraint |
43 | 43 | */ |
44 | - public function isEqual(NumberInterface|int|string|float $value): bool |
|
44 | + public function isEqual(NumberInterface | int | string | float $value): bool |
|
45 | 45 | { |
46 | 46 | |
47 | 47 | $check = $this->checkComparisonTraitAndInterface(); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function sort(): NumberCollectionInterface |
181 | 181 | { |
182 | - $this->getCollection()->sort(function($left, $right){ |
|
182 | + $this->getCollection()->sort(function($left, $right) { |
|
183 | 183 | return ArithmeticProvider::compare($left->getAsBaseTenRealNumber(), $right->getAsBaseTenRealNumber()); |
184 | 184 | }); |
185 | 185 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | */ |
313 | 313 | public function getRandom(): NumberInterface |
314 | 314 | { |
315 | - $maxKey = $this->getCollection()->count() - 1; |
|
315 | + $maxKey = $this->getCollection()->count()-1; |
|
316 | 316 | |
317 | 317 | $key = RandomProvider::randomInt(0, $maxKey, RandomMode::Speed)->asInt(); |
318 | 318 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * @throws IntegrityConstraint |
22 | 22 | * @throws MissingPackage |
23 | 23 | */ |
24 | - public function continuousModulo(NumberInterface|string|int|float $mod): DecimalInterface |
|
24 | + public function continuousModulo(NumberInterface | string | int | float $mod): DecimalInterface |
|
25 | 25 | { |
26 | 26 | |
27 | 27 | $mod = Numbers::makeOrDont(Numbers::IMMUTABLE, $mod, $this->scale+1); |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | public static function radiansToDegrees($radians) |
22 | 22 | { |
23 | 23 | $radians = Numbers::makeOrDont(Numbers::IMMUTABLE, $radians); |
24 | - $pi = Numbers::makePi($radians->getScale() + 2); |
|
24 | + $pi = Numbers::makePi($radians->getScale()+2); |
|
25 | 25 | |
26 | - return $radians->multiply(180)->divide($pi, $radians->getScale() + 2)->round($radians->getScale() - 2)->getValue(NumberBase::Ten); |
|
26 | + return $radians->multiply(180)->divide($pi, $radians->getScale()+2)->round($radians->getScale()-2)->getValue(NumberBase::Ten); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public static function degreesToRadians($degrees) |
36 | 36 | { |
37 | 37 | $degrees = Numbers::makeOrDont(Numbers::IMMUTABLE, $degrees); |
38 | - $pi = Numbers::makePi($degrees->getScale() + 1); |
|
38 | + $pi = Numbers::makePi($degrees->getScale()+1); |
|
39 | 39 | |
40 | 40 | return $degrees->multiply($pi)->divide(180)->round($degrees->getScale())->getValue(NumberBase::Ten); |
41 | 41 | } |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | } else { |
44 | 44 | $abs = $this instanceof ImmutableDecimal ? $this->abs() : new ImmutableDecimal($this->absValue()); |
45 | 45 | $addScale = $abs->asInt() > $abs->getScale() ? $abs->asInt() : $abs->getScale(); |
46 | - $intScale = $scale + $addScale; |
|
46 | + $intScale = $scale+$addScale; |
|
47 | 47 | $x = new ImmutableDecimal($this->getValue(NumberBase::Ten), $intScale); |
48 | 48 | $x2 = $x->pow(2); |
49 | 49 | $one = new ImmutableDecimal(1, $intScale); |
50 | 50 | |
51 | - $aPart = new class($x2, $intScale) implements ContinuedFractionTermInterface{ |
|
51 | + $aPart = new class($x2, $intScale) implements ContinuedFractionTermInterface { |
|
52 | 52 | private ImmutableDecimal $x2; |
53 | 53 | private ImmutableDecimal $negTwo; |
54 | 54 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | } |
77 | 77 | }; |
78 | 78 | |
79 | - $bPart = new class() implements ContinuedFractionTermInterface{ |
|
79 | + $bPart = new class() implements ContinuedFractionTermInterface { |
|
80 | 80 | /** |
81 | 81 | * @param int $n |
82 | 82 | * @return ImmutableDecimal |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } elseif ($this->isEqual(1)) { |
118 | 118 | $answer = Numbers::makeZero(); |
119 | 119 | } else { |
120 | - $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $scale + 2); |
|
120 | + $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $scale+2); |
|
121 | 121 | |
122 | 122 | $answer = $piDivTwo->subtract($z->arcsin($scale+2)); |
123 | 123 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | $scale = $scale ?? $this->getScale(); |
140 | 140 | $abs = $this instanceof ImmutableDecimal ? $this->abs() : new ImmutableDecimal($this->absValue()); |
141 | - $intScale = $scale + 2; |
|
141 | + $intScale = $scale+2; |
|
142 | 142 | $terms = $abs->multiply($intScale+8)->asInt(); |
143 | 143 | $x = new ImmutableDecimal($this->getValue(NumberBase::Ten), $intScale); |
144 | 144 | $aPart = new class($x) implements ContinuedFractionTermInterface { |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | return Numbers::makeZero($this->intScale); |
188 | 188 | } |
189 | 189 | |
190 | - return SequenceProvider::nthOddNumber($n - 1)->truncateToScale($this->intScale); |
|
190 | + return SequenceProvider::nthOddNumber($n-1)->truncateToScale($this->intScale); |
|
191 | 191 | } |
192 | 192 | }; |
193 | 193 | |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | |
209 | 209 | $scale = $scale ?? $this->getScale(); |
210 | 210 | |
211 | - $piDivTwo = Numbers::makePi($scale + 2)->divide(2, $scale + 2); |
|
211 | + $piDivTwo = Numbers::makePi($scale+2)->divide(2, $scale+2); |
|
212 | 212 | |
213 | - $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $scale + 2); |
|
213 | + $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $scale+2); |
|
214 | 214 | |
215 | 215 | $arctan = $z->arctan($scale+2, false); |
216 | 216 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | { |
230 | 230 | |
231 | 231 | $scale = $scale ?? $this->getScale(); |
232 | - $intScale = $scale + 2; |
|
232 | + $intScale = $scale+2; |
|
233 | 233 | |
234 | 234 | $one = Numbers::makeOne($intScale); |
235 | 235 | $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this->getValue(NumberBase::Ten), $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_SUB |
293 | 293 | ); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | { |
306 | 306 | |
307 | 307 | $scale = $scale ?? $this->getScale(); |
308 | - $intScale = $scale + 2; |
|
308 | + $intScale = $scale+2; |
|
309 | 309 | |
310 | 310 | $one = Numbers::makeOne($intScale); |
311 | 311 | $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $intScale); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $answer = SeriesProvider::generalizedContinuedFraction( |
361 | 361 | $aPart, |
362 | 362 | $bPart, |
363 | - $intScale * 2, |
|
363 | + $intScale*2, |
|
364 | 364 | $intScale, |
365 | 365 | SeriesProvider::SUM_MODE_ALT_FIRST_ADD |
366 | 366 | ); |