@@ 214-221 (lines=8) @@ | ||
211 | * @param int $scale |
|
212 | * @return string |
|
213 | */ |
|
214 | private function add($s1, $s2, $scale) |
|
215 | { |
|
216 | if ($this->bcmath) { |
|
217 | return bcadd($s1, $s2, $scale); |
|
218 | } else { |
|
219 | return $this->scale((float)$s1 + (float)$s2, $scale); |
|
220 | } |
|
221 | } |
|
222 | ||
223 | /** |
|
224 | * Multiples two numbers, using arbitrary precision when available. |
|
@@ 230-237 (lines=8) @@ | ||
227 | * @param int $scale |
|
228 | * @return string |
|
229 | */ |
|
230 | private function mul($s1, $s2, $scale) |
|
231 | { |
|
232 | if ($this->bcmath) { |
|
233 | return bcmul($s1, $s2, $scale); |
|
234 | } else { |
|
235 | return $this->scale((float)$s1 * (float)$s2, $scale); |
|
236 | } |
|
237 | } |
|
238 | ||
239 | /** |
|
240 | * Divides two numbers, using arbitrary precision when available. |
|
@@ 246-253 (lines=8) @@ | ||
243 | * @param int $scale |
|
244 | * @return string |
|
245 | */ |
|
246 | private function div($s1, $s2, $scale) |
|
247 | { |
|
248 | if ($this->bcmath) { |
|
249 | return bcdiv($s1, $s2, $scale); |
|
250 | } else { |
|
251 | return $this->scale((float)$s1 / (float)$s2, $scale); |
|
252 | } |
|
253 | } |
|
254 | ||
255 | /** |
|
256 | * Rounds a number according to the number of sigfigs it should have, |