@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | protected function helperArctanGCF(ImmutableDecimal $num, ?int $scale): ImmutableDecimal |
27 | 27 | { |
28 | 28 | $scale = $scale ?? $this->getScale(); |
29 | - $intScale = $scale + 2; |
|
30 | - $terms = $intScale + 2; |
|
29 | + $intScale = $scale+2; |
|
30 | + $terms = $intScale+2; |
|
31 | 31 | $x = new ImmutableDecimal($num, $intScale); |
32 | 32 | $aPart = new class($x) implements ContinuedFractionTermInterface { |
33 | 33 | private ImmutableDecimal $x; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | return Numbers::makeZero($this->intScale); |
76 | 76 | } |
77 | 77 | |
78 | - return SequenceProvider::nthOddNumber($n - 1); |
|
78 | + return SequenceProvider::nthOddNumber($n-1); |
|
79 | 79 | } |
80 | 80 | }; |
81 | 81 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $x2 = $x->pow(2); |
97 | 97 | $one = new ImmutableDecimal(1, $scale); |
98 | 98 | |
99 | - $aPart = new class($x2, $scale) implements ContinuedFractionTermInterface{ |
|
99 | + $aPart = new class($x2, $scale) implements ContinuedFractionTermInterface { |
|
100 | 100 | private ImmutableDecimal $x2; |
101 | 101 | private ImmutableDecimal $negTwo; |
102 | 102 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | }; |
126 | 126 | |
127 | - $bPart = new class() implements ContinuedFractionTermInterface{ |
|
127 | + $bPart = new class() implements ContinuedFractionTermInterface { |
|
128 | 128 | /** |
129 | 129 | * @param int $n |
130 | 130 | * @return ImmutableDecimal |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | } elseif ($this->isEqual(0)) { |
44 | 44 | $answer = Numbers::makeZero(); |
45 | 45 | } else { |
46 | - $intScale = $scale + 2; |
|
46 | + $intScale = $scale+2; |
|
47 | 47 | $num = new ImmutableDecimal($this->getValue(NumberBase::Ten), $intScale); |
48 | 48 | |
49 | 49 | $answer = $this->helperArcsinGCF($num, $intScale); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } elseif ($this->isEqual(1)) { |
74 | 74 | $answer = Numbers::makeZero(); |
75 | 75 | } else { |
76 | - $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $scale + 2); |
|
76 | + $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $scale+2); |
|
77 | 77 | |
78 | 78 | $answer = $piDivTwo->subtract($z->arcsin($scale+2)); |
79 | 79 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | protected function arctanScale(int $scale = null): string |
92 | 92 | { |
93 | - $intScale = ($scale ?? $this->getScale()) + 2; |
|
93 | + $intScale = ($scale ?? $this->getScale())+2; |
|
94 | 94 | |
95 | 95 | $thisNum = Numbers::makeOrDont(Numbers::IMMUTABLE, $this->absValue()); |
96 | 96 | |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | |
128 | 128 | $scale = $scale ?? $this->getScale(); |
129 | 129 | |
130 | - $piDivTwo = Numbers::makePi($scale + 2)->divide(2, $scale + 2); |
|
130 | + $piDivTwo = Numbers::makePi($scale+2)->divide(2, $scale+2); |
|
131 | 131 | |
132 | - $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this->absValue(), $scale + 2); |
|
132 | + $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this->absValue(), $scale+2); |
|
133 | 133 | |
134 | 134 | $arctan = $z->arctan($scale+2, false); |
135 | 135 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | { |
153 | 153 | |
154 | 154 | $scale = $scale ?? $this->getScale(); |
155 | - $intScale = $scale + 2; |
|
155 | + $intScale = $scale+2; |
|
156 | 156 | |
157 | 157 | $one = Numbers::makeOne($intScale); |
158 | 158 | $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this->absValue(), $intScale); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $answer = SeriesProvider::generalizedContinuedFraction( |
209 | 209 | $aPart, |
210 | 210 | $bPart, |
211 | - $intScale * 2, |
|
211 | + $intScale*2, |
|
212 | 212 | $intScale, |
213 | 213 | SeriesProvider::SUM_MODE_SUB |
214 | 214 | ); |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | { |
232 | 232 | |
233 | 233 | $scale = $scale ?? $this->getScale(); |
234 | - $intScale = $scale + 2; |
|
234 | + $intScale = $scale+2; |
|
235 | 235 | |
236 | 236 | $one = Numbers::makeOne($intScale); |
237 | 237 | $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $intScale); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $answer = SeriesProvider::generalizedContinuedFraction( |
287 | 287 | $aPart, |
288 | 288 | $bPart, |
289 | - $intScale * 2, |
|
289 | + $intScale*2, |
|
290 | 290 | $intScale, |
291 | 291 | SeriesProvider::SUM_MODE_ALT_FIRST_ADD |
292 | 292 | ); |
@@ -69,9 +69,9 @@ |
||
69 | 69 | $piDiv2 = M_PI_2; |
70 | 70 | |
71 | 71 | if ($thisNum < 0) { |
72 | - return -1 * ($piDiv2 - atan(abs($thisNum))); |
|
72 | + return -1*($piDiv2-atan(abs($thisNum))); |
|
73 | 73 | } else { |
74 | - return $piDiv2 - atan($thisNum); |
|
74 | + return $piDiv2-atan($thisNum); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 |
@@ -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->asReal(), $num->asReal(), $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())); |