1
0
mirror of https://github.com/php/php-src.git synced 2026-03-28 10:12:18 +01:00
Files
archived-php-src/ext/bcmath/tests/bcpow.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

19 lines
305 B
PHP

--TEST--
bcpow() function
--SKIPIF--
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
--INI--
bcmath.scale=0
--FILE--
<?php
echo bcpow("1", "2"),"\n";
echo bcpow("-2", "5", 4),"\n";
echo bcpow("2", "64"),"\n";
echo bcpow("-2.555", "5", 2),"\n";
?>
--EXPECT--
1
-32.0000
18446744073709551616
-108.88