diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2017-09-09 15:43:02 +0200 |
---|---|---|
committer | Sara Golemon <pollita@php.net> | 2017-11-06 17:26:52 -0500 |
commit | b152633ecb2030e2de1f83d2d42193185ea1bc21 (patch) | |
tree | 11ad6377b3c60ca605fdcd4857052613d202b71b /ext/bcmath/tests | |
parent | 5cdf37e6033cf7053132126157747511c2c039f2 (diff) | |
download | php-git-b152633ecb2030e2de1f83d2d42193185ea1bc21.tar.gz |
Scale support for bcmod()
As of commit 90dcbbe (PHP-7.2+) bcmod() supports non-integral
parameters as well. Since formerly only integer modulus has been
supported, it did not make much sense to cater to the scale with regard
to the result. However, now it does for consistency with other BCMath
operations.
Therefore, we add support for an optional `scale` parameter and fall
back to the default scale (`bcmath.scale`) as usual.
Diffstat (limited to 'ext/bcmath/tests')
-rw-r--r-- | ext/bcmath/tests/bcmod.phpt | 4 | ||||
-rw-r--r-- | ext/bcmath/tests/bcmod_error1.phpt | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/ext/bcmath/tests/bcmod.phpt b/ext/bcmath/tests/bcmod.phpt index 5657e02ddc..3e9ab25cb8 100644 --- a/ext/bcmath/tests/bcmod.phpt +++ b/ext/bcmath/tests/bcmod.phpt @@ -9,7 +9,7 @@ bcmath.scale=0 echo bcmod("11", "2"),"\n"; echo bcmod("-1", "5"),"\n"; echo bcmod("8728932001983192837219398127471", "1928372132132819737213"),"\n"; -echo bcmod("3.5", "4"),"\n"; +echo bcmod("3.5", "4", 1),"\n"; echo bcmod("1071", "357.5"),"\n"; ?> --EXPECT-- @@ -17,4 +17,4 @@ echo bcmod("1071", "357.5"),"\n"; -1 1459434331351930289678 3.5 -356.0 +356 diff --git a/ext/bcmath/tests/bcmod_error1.phpt b/ext/bcmath/tests/bcmod_error1.phpt index e36dce285d..68a6dae470 100644 --- a/ext/bcmath/tests/bcmod_error1.phpt +++ b/ext/bcmath/tests/bcmod_error1.phpt @@ -7,7 +7,7 @@ antoni@solucionsinternet.com <?php if(!extension_loaded("bcmath")) print "skip"; ?> --FILE-- <?php -echo bcmod('1', '2', '3'); +echo bcmod('1', '2', '3', '4'); ?> --EXPECTF-- -Warning: bcmod() expects exactly 2 parameters, 3 given in %s.php on line %d +Warning: bcmod() expects at most 3 parameters, 4 given in %s.php on line %d |