php-src/ext/bcmath/tests/bug.66364.phpt
Christoph M. Becker 870ed5106d Fixed bug #66364 (BCMath bcmul ignores scale parameter)
We change `bcmul()` and `bcpow()` so that the result has exactly the
requested scale (i.e. decimal places) to make them consistent with the
other BCMath functions.  This also changes our stance regarding bug
#52748, which had been classified as documentation problem.

We do not manipulate the numbers themselves (anymore), but rather
introduce `bc_num2str_ex()` which accepts a scale parameter that
overrides the scale of the number by omitting extraneous decimals and
adding zeros, respectively.  This also allows us to get rid of
`split_bc_num()`, which fixes bug #75164 as well.
2017-09-08 18:31:04 +02:00

15 lines
260 B
PHP

--TEST--
Bug #66364 (BCMath bcmul ignores scale parameter)
--SKIPIF--
<?php
if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
?>
--FILE--
<?php
var_dump(bcmul('0.3', '0.2', 4));
?>
===DONE===
--EXPECT--
string(6) "0.0600"
===DONE===