mirror of
https://github.com/php/php-src.git
synced 2026-03-28 10:12:18 +01:00
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.
19 lines
305 B
PHP
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
|