@@ -198,16 +198,16 @@ |
||
| 198 | 198 | * @var ImmutableDecimal $value1 |
| 199 | 199 | */ |
| 200 | 200 | foreach ($largerGroup as $key1 => $value1) { |
| 201 | - $largerKey = $largerExp - $key1; |
|
| 201 | + $largerKey = $largerExp-$key1; |
|
| 202 | 202 | |
| 203 | 203 | /** |
| 204 | 204 | * @var int $key2 |
| 205 | 205 | * @var ImmutableDecimal $value2 |
| 206 | 206 | */ |
| 207 | 207 | foreach ($smallerGroup as $key2 => $value2) { |
| 208 | - $smallerKey = $smallerExp - $key2; |
|
| 208 | + $smallerKey = $smallerExp-$key2; |
|
| 209 | 209 | $newVal = $value1->multiply($value2); |
| 210 | - $newExp = $largerKey + $smallerKey; |
|
| 210 | + $newExp = $largerKey+$smallerKey; |
|
| 211 | 211 | |
| 212 | 212 | if (isset($finalCoefs[$newExp])) { |
| 213 | 213 | $finalCoefs[$newExp] = $finalCoefs[$newExp]->add($newVal); |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | $value = $this->convertValue($value, $base, 10); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - $value = (string)$value; |
|
| 44 | + $value = (string) $value; |
|
| 45 | 45 | $this->value = $this->translateValue($value); |
| 46 | 46 | |
| 47 | 47 | if (!is_null($precision)) { |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | } elseif ($this->isEqual(0)) { |
| 26 | 26 | $answer = Numbers::makeZero(); |
| 27 | 27 | } else { |
| 28 | - $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision + 2); |
|
| 28 | + $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2); |
|
| 29 | 29 | $one = Numbers::makeOne($precision+2); |
| 30 | 30 | |
| 31 | 31 | if ($z->abs()->isGreaterThan(1)) { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | ); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - $answer = $z->divide($one->subtract($z->pow(2))->sqrt($precision + 2), $precision + 2)->arctan($precision + 2, false); |
|
| 39 | + $answer = $z->divide($one->subtract($z->pow(2))->sqrt($precision+2), $precision+2)->arctan($precision+2, false); |
|
| 40 | 40 | } |
| 41 | 41 | if ($round) { |
| 42 | 42 | $answer = $answer->roundToPrecision($precision); |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | } elseif ($this->isEqual(1)) { |
| 62 | 62 | $answer = Numbers::makeZero(); |
| 63 | 63 | } else { |
| 64 | - $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision + 2); |
|
| 65 | - $one = Numbers::makeOne($precision + 2); |
|
| 64 | + $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2); |
|
| 65 | + $one = Numbers::makeOne($precision+2); |
|
| 66 | 66 | |
| 67 | 67 | if ($z->abs()->isGreaterThan(1)) { |
| 68 | 68 | throw new IntegrityConstraint( |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $answer = $one->subtract($z->pow(2)) |
| 76 | - ->sqrt($precision + 2) |
|
| 77 | - ->divide($z, $precision + 2) |
|
| 78 | - ->arctan($precision + 2, false); |
|
| 76 | + ->sqrt($precision+2) |
|
| 77 | + ->divide($z, $precision+2) |
|
| 78 | + ->arctan($precision+2, false); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | if ($round) { |
@@ -93,39 +93,39 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | $precision = $precision ?? $this->getPrecision(); |
| 95 | 95 | |
| 96 | - $one = Numbers::makeOne($precision + 2); |
|
| 96 | + $one = Numbers::makeOne($precision+2); |
|
| 97 | 97 | |
| 98 | - $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision + 2); |
|
| 98 | + $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2); |
|
| 99 | 99 | |
| 100 | 100 | if ($z->isEqual(1)) { |
| 101 | - $answer = Numbers::makePi($precision + 2)->divide(4, $precision + 2); |
|
| 101 | + $answer = Numbers::makePi($precision+2)->divide(4, $precision+2); |
|
| 102 | 102 | } elseif ($z->isEqual(-1)) { |
| 103 | - $answer = Numbers::makePi($precision + 2)->divide(4, $precision +2)->multiply(-1); |
|
| 103 | + $answer = Numbers::makePi($precision+2)->divide(4, $precision+2)->multiply(-1); |
|
| 104 | 104 | } else { |
| 105 | 105 | |
| 106 | 106 | if ($z->abs()->isGreaterThan(1)) { |
| 107 | - $rangeAdjust = Numbers::makePi($precision + 2)->divide(2, $precision + 2); |
|
| 107 | + $rangeAdjust = Numbers::makePi($precision+2)->divide(2, $precision+2); |
|
| 108 | 108 | |
| 109 | 109 | if ($z->isNegative()) { |
| 110 | 110 | $rangeAdjust = $rangeAdjust->multiply(-1); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - $z = $one->divide($z, $precision + 2); |
|
| 113 | + $z = $one->divide($z, $precision+2); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | $answer = SeriesProvider::maclaurinSeries( |
| 117 | 117 | $z, |
| 118 | - function ($n) { |
|
| 118 | + function($n) { |
|
| 119 | 119 | return SequenceProvider::nthPowerNegativeOne($n); |
| 120 | 120 | }, |
| 121 | - function ($n) { |
|
| 121 | + function($n) { |
|
| 122 | 122 | return SequenceProvider::nthOddNumber($n); |
| 123 | 123 | }, |
| 124 | - function ($n) { |
|
| 124 | + function($n) { |
|
| 125 | 125 | return SequenceProvider::nthOddNumber($n); |
| 126 | 126 | }, |
| 127 | 127 | 0, |
| 128 | - $precision + 1 |
|
| 128 | + $precision+1 |
|
| 129 | 129 | ); |
| 130 | 130 | |
| 131 | 131 | if (isset($rangeAdjust)) { |
@@ -148,9 +148,9 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | $precision = $precision ?? $this->getPrecision(); |
| 150 | 150 | |
| 151 | - $piDivTwo = Numbers::makePi($precision + 2)->divide(2, $precision + 2); |
|
| 151 | + $piDivTwo = Numbers::makePi($precision+2)->divide(2, $precision+2); |
|
| 152 | 152 | |
| 153 | - $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision + 2); |
|
| 153 | + $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2); |
|
| 154 | 154 | |
| 155 | 155 | $arctan = $z->arctan($precision+2, false); |
| 156 | 156 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | $precision = $precision ?? $this->getPrecision(); |
| 173 | 173 | |
| 174 | - $one = Numbers::makeOne($precision + 2); |
|
| 174 | + $one = Numbers::makeOne($precision+2); |
|
| 175 | 175 | $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2); |
| 176 | 176 | |
| 177 | 177 | if ($z->abs()->isLessThan(1)) { |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | ); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - $answer = $one->divide($z, $precision + 2)->arccos($precision + 2); |
|
| 185 | + $answer = $one->divide($z, $precision+2)->arccos($precision+2); |
|
| 186 | 186 | |
| 187 | 187 | if ($round) { |
| 188 | 188 | $answer = $answer->roundToPrecision($precision); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | $precision = $precision ?? $this->getPrecision(); |
| 201 | 201 | |
| 202 | - $one = Numbers::makeOne($precision + 2); |
|
| 202 | + $one = Numbers::makeOne($precision+2); |
|
| 203 | 203 | $z = Numbers::makeOrDont(Numbers::IMMUTABLE, $this, $precision+2); |
| 204 | 204 | |
| 205 | 205 | if ($z->abs()->isLessThan(1)) { |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | ); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - $answer = $one->divide($z, $precision + 2)->arcsin($precision + 2); |
|
| 213 | + $answer = $one->divide($z, $precision+2)->arcsin($precision+2); |
|
| 214 | 214 | |
| 215 | 215 | if ($round) { |
| 216 | 216 | $answer = $answer->roundToPrecision($precision); |