@@ -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 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | $calcMode = $this->getMode(); |
24 | 24 | |
25 | 25 | return match ($calcMode) { |
26 | - CalcMode::Native => (string)$this->expNative(), |
|
26 | + CalcMode::Native => (string) $this->expNative(), |
|
27 | 27 | default => $this->expScale($scale) |
28 | 28 | }; |
29 | 29 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $calcMode = $this->getMode(); |
40 | 40 | |
41 | 41 | return match ($calcMode) { |
42 | - CalcMode::Native => (string)$this->lnNative(), |
|
42 | + CalcMode::Native => (string) $this->lnNative(), |
|
43 | 43 | default => $this->lnScale($scale) |
44 | 44 | }; |
45 | 45 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $calcMode = $this->getMode(); |
55 | 55 | |
56 | 56 | return match ($calcMode) { |
57 | - CalcMode::Native => (string)$this->log10Native(), |
|
57 | + CalcMode::Native => (string) $this->log10Native(), |
|
58 | 58 | default => $this->log10Scale($scale) |
59 | 59 | }; |
60 | 60 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $total = strlen($fractional); |
148 | 148 | $fractional = ltrim($fractional, '0'); |
149 | 149 | |
150 | - return ($total - strlen($fractional)); |
|
150 | + return ($total-strlen($fractional)); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | public function isFloat(): bool |
235 | 235 | { |
236 | 236 | |
237 | - return (bool)ArithmeticProvider::compare($this->getDecimalPart(), '0'); |
|
237 | + return (bool) ArithmeticProvider::compare($this->getDecimalPart(), '0'); |
|
238 | 238 | |
239 | 239 | } |
240 | 240 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function asFloat(): float |
245 | 245 | { |
246 | - return (float)$this->asReal(); |
|
246 | + return (float) $this->asReal(); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $calcMode = $this->getMode(); |
21 | 21 | |
22 | 22 | return match ($calcMode) { |
23 | - CalcMode::Native => (string)$this->sinNative(), |
|
23 | + CalcMode::Native => (string) $this->sinNative(), |
|
24 | 24 | default => $this->sinScale($scale) |
25 | 25 | }; |
26 | 26 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $calcMode = $this->getMode(); |
35 | 35 | |
36 | 36 | return match ($calcMode) { |
37 | - CalcMode::Native => (string)$this->cosNative(), |
|
37 | + CalcMode::Native => (string) $this->cosNative(), |
|
38 | 38 | default => $this->cosScale($scale) |
39 | 39 | }; |
40 | 40 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $calcMode = $this->getMode(); |
49 | 49 | |
50 | 50 | return match ($calcMode) { |
51 | - CalcMode::Native => (string)$this->tanNative(), |
|
51 | + CalcMode::Native => (string) $this->tanNative(), |
|
52 | 52 | default => $this->tanScale($scale) |
53 | 53 | }; |
54 | 54 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $calcMode = $this->getMode(); |
64 | 64 | |
65 | 65 | return match ($calcMode) { |
66 | - CalcMode::Native => (string)$this->secNative(), |
|
66 | + CalcMode::Native => (string) $this->secNative(), |
|
67 | 67 | default => $this->secScale($scale) |
68 | 68 | }; |
69 | 69 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $calcMode = $this->getMode(); |
79 | 79 | |
80 | 80 | return match ($calcMode) { |
81 | - CalcMode::Native => (string)$this->cscNative(), |
|
81 | + CalcMode::Native => (string) $this->cscNative(), |
|
82 | 82 | default => $this->cscScale($scale) |
83 | 83 | }; |
84 | 84 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $calcMode = $this->getMode(); |
94 | 94 | |
95 | 95 | return match ($calcMode) { |
96 | - CalcMode::Native => (string)$this->cotNative(), |
|
96 | + CalcMode::Native => (string) $this->cotNative(), |
|
97 | 97 | default => $this->cotScale($scale) |
98 | 98 | }; |
99 | 99 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $calcMode = $this->getMode(); |
108 | 108 | |
109 | 109 | return match ($calcMode) { |
110 | - CalcMode::Native => (string)$this->sinhNative(), |
|
110 | + CalcMode::Native => (string) $this->sinhNative(), |
|
111 | 111 | default => $this->sinhScale($scale) |
112 | 112 | }; |
113 | 113 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $calcMode = $this->getMode(); |
122 | 122 | |
123 | 123 | return match ($calcMode) { |
124 | - CalcMode::Native => (string)$this->coshNative(), |
|
124 | + CalcMode::Native => (string) $this->coshNative(), |
|
125 | 125 | default => $this->coshScale($scale) |
126 | 126 | }; |
127 | 127 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $calcMode = $this->getMode(); |
136 | 136 | |
137 | 137 | return match ($calcMode) { |
138 | - CalcMode::Native => (string)$this->tanhNative(), |
|
138 | + CalcMode::Native => (string) $this->tanhNative(), |
|
139 | 139 | default => $this->tanhScale($scale) |
140 | 140 | }; |
141 | 141 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $calcMode = $this->getMode(); |
151 | 151 | |
152 | 152 | return match ($calcMode) { |
153 | - CalcMode::Native => (string)$this->sechNative(), |
|
153 | + CalcMode::Native => (string) $this->sechNative(), |
|
154 | 154 | default => $this->sechScale($scale) |
155 | 155 | }; |
156 | 156 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $calcMode = $this->getMode(); |
165 | 165 | |
166 | 166 | return match ($calcMode) { |
167 | - CalcMode::Native => (string)$this->cschNative(), |
|
167 | + CalcMode::Native => (string) $this->cschNative(), |
|
168 | 168 | default => $this->cschScale($scale) |
169 | 169 | }; |
170 | 170 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $calcMode = $this->getMode(); |
180 | 180 | |
181 | 181 | return match ($calcMode) { |
182 | - CalcMode::Native => (string)$this->cothNative(), |
|
182 | + CalcMode::Native => (string) $this->cothNative(), |
|
183 | 183 | default => $this->cothScale($scale) |
184 | 184 | }; |
185 | 185 | } |
@@ -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 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $calcMode = $this->getMode(); |
20 | 20 | |
21 | 21 | return match ($calcMode) { |
22 | - CalcMode::Native => (string)$this->arcsinNative(), |
|
22 | + CalcMode::Native => (string) $this->arcsinNative(), |
|
23 | 23 | default => $this->arcsinScale($scale) |
24 | 24 | }; |
25 | 25 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $calcMode = $this->getMode(); |
34 | 34 | |
35 | 35 | return match ($calcMode) { |
36 | - CalcMode::Native => (string)$this->arccosNative(), |
|
36 | + CalcMode::Native => (string) $this->arccosNative(), |
|
37 | 37 | default => $this->arccosScale($scale) |
38 | 38 | }; |
39 | 39 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $calcMode = $this->getMode(); |
48 | 48 | |
49 | 49 | return match ($calcMode) { |
50 | - CalcMode::Native => (string)$this->arctanNative(), |
|
50 | + CalcMode::Native => (string) $this->arctanNative(), |
|
51 | 51 | default => $this->arctanScale($scale) |
52 | 52 | }; |
53 | 53 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $calcMode = $this->getMode(); |
62 | 62 | |
63 | 63 | return match ($calcMode) { |
64 | - CalcMode::Native => (string)$this->arcsecNative(), |
|
64 | + CalcMode::Native => (string) $this->arcsecNative(), |
|
65 | 65 | default => $this->arcsecScale($scale) |
66 | 66 | }; |
67 | 67 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $calcMode = $this->getMode(); |
76 | 76 | |
77 | 77 | return match ($calcMode) { |
78 | - CalcMode::Native => (string)$this->arccscNative(), |
|
78 | + CalcMode::Native => (string) $this->arccscNative(), |
|
79 | 79 | default => $this->arccscScale($scale) |
80 | 80 | }; |
81 | 81 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $calcMode = $this->getMode(); |
90 | 90 | |
91 | 91 | return match ($calcMode) { |
92 | - CalcMode::Native => (string)$this->arccotNative(), |
|
92 | + CalcMode::Native => (string) $this->arccotNative(), |
|
93 | 93 | default => $this->arccotScale($scale) |
94 | 94 | }; |
95 | 95 | } |
@@ -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 |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | $scale = $scale ?? $this->getScale(); |
35 | 35 | $modScale = ($scale > $this->getScale()) ? $scale : $this->getScale(); |
36 | 36 | |
37 | - $twoPi = Numbers::make2Pi($modScale * 2); |
|
38 | - $pi = Numbers::makePi( $scale + 2 ); |
|
37 | + $twoPi = Numbers::make2Pi($modScale*2); |
|
38 | + $pi = Numbers::makePi($scale+2); |
|
39 | 39 | |
40 | 40 | if ($pi->truncate($scale)->isEqual($this) || $twoPi->truncate($scale)->isEqual($this)) { |
41 | 41 | return '0'; |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | |
48 | 48 | $answer = SeriesProvider::maclaurinSeries( |
49 | 49 | $modulo, |
50 | - function ($n) use ($scale, $negOne, $one) { |
|
50 | + function($n) use ($scale, $negOne, $one) { |
|
51 | 51 | |
52 | - return $n % 2 ? $negOne : $one; |
|
52 | + return $n%2 ? $negOne : $one; |
|
53 | 53 | }, |
54 | - function ($n) { |
|
54 | + function($n) { |
|
55 | 55 | return SequenceProvider::nthOddNumber($n); |
56 | 56 | }, |
57 | - function ($n) { |
|
57 | + function($n) { |
|
58 | 58 | return SequenceProvider::nthOddNumber($n)->factorial(); |
59 | 59 | }, |
60 | 60 | 0, |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | $scale = $scale ?? $this->getScale(); |
81 | 81 | $modScale = ($scale > $this->getScale()) ? $scale : $this->getScale(); |
82 | 82 | |
83 | - $twoPi = Numbers::make2Pi($modScale * 2); |
|
84 | - $pi = Numbers::makePi( $scale + 2 ); |
|
83 | + $twoPi = Numbers::make2Pi($modScale*2); |
|
84 | + $pi = Numbers::makePi($scale+2); |
|
85 | 85 | |
86 | 86 | if ($twoPi->truncate($scale)->isEqual($this)) { |
87 | 87 | return '1'; |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | |
98 | 98 | $answer = SeriesProvider::maclaurinSeries( |
99 | 99 | $modulo, |
100 | - function ($n) use ($scale, $negOne, $one) { |
|
100 | + function($n) use ($scale, $negOne, $one) { |
|
101 | 101 | |
102 | - return $n % 2 ? $negOne : $one; |
|
102 | + return $n%2 ? $negOne : $one; |
|
103 | 103 | }, |
104 | - function ($n) { |
|
104 | + function($n) { |
|
105 | 105 | return SequenceProvider::nthEvenNumber($n); |
106 | 106 | }, |
107 | - function ($n) { |
|
107 | + function($n) { |
|
108 | 108 | return SequenceProvider::nthEvenNumber($n)->factorial(); |
109 | 109 | }, |
110 | 110 | 0, |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | protected function tanScale(int $scale = null): string |
124 | 124 | { |
125 | 125 | $scale = $scale ?? $this->getScale(); |
126 | - $intScale = $scale + 2; |
|
126 | + $intScale = $scale+2; |
|
127 | 127 | |
128 | 128 | $pi = Numbers::makePi($intScale); |
129 | 129 | $piDivTwo = Numbers::makePi($intScale)->divide(2); |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | |
267 | 267 | if ($mod2Pi->isEqual(0)) { |
268 | 268 | return static::INFINITY; |
269 | - } elseif($modPi->isEqual(0)) { |
|
269 | + } elseif ($modPi->isEqual(0)) { |
|
270 | 270 | return static::NEG_INFINITY; |
271 | 271 | } |
272 | 272 |