mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
870ed5106d
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.
15 lines
260 B
PHP
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===
|