| Conditions | 3 |
| Paths | 3 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 27 | public static function makeE(int $digits): string |
||
| 28 | { |
||
| 29 | |||
| 30 | $internalPrecision = $digits + 5; |
||
| 31 | |||
| 32 | $one = Numbers::makeOne($internalPrecision)->setMode(Selectable::CALC_MODE_PRECISION); |
||
| 33 | $denominator = Numbers::make(Numbers::MUTABLE, '1', $internalPrecision)->setMode(Selectable::CALC_MODE_PRECISION); |
||
| 34 | $e = Numbers::make(NUmbers::MUTABLE, '2', $internalPrecision)->setMode(Selectable::CALC_MODE_PRECISION); |
||
| 35 | $n = Numbers::make(Numbers::MUTABLE, '2', $internalPrecision)->setMode(Selectable::CALC_MODE_PRECISION); |
||
| 36 | |||
| 37 | $continue = true; |
||
| 38 | |||
| 39 | while ($continue) { |
||
| 40 | $denominator->multiply($n); |
||
| 41 | $n->add($one); |
||
| 42 | $term = $one->divide($denominator); |
||
| 43 | |||
| 44 | if ($term->numberOfLeadingZeros() > $internalPrecision) { |
||
| 45 | $continue = false; |
||
| 46 | } |
||
| 47 | |||
| 48 | $e->add($term); |
||
| 49 | } |
||
| 50 | |||
| 51 | return $e->truncateToPrecision($digits)->getValue(); |
||
| 52 | |||
| 55 | } |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.