@ -0,0 +1,12 @@
--TEST--
bcadd() incorrect argument count
--SKIPIF--
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
--INI--
bcmath.scale=0
--FILE--
<?php
echo bcadd();
?>
--EXPECTF--
Warning: bcadd() expects at least 2 parameters, 0 given in %s on line %d
@ -0,0 +1,16 @@
bcadd() with non-integers
bcmath.scale=5
echo bcadd("2.2", "4.3", "2")."\n";
echo bcadd("2.2", "-7.3", "1")."\n";
echo bcadd("-4.27", "7.3");
6.50
-5.1
3.03000
bccomp() with non-integers
echo bccomp("2.2", "2.2", "2")."\n";
echo bccomp("2.32", "2.2", "2")."\n";
echo bccomp("2.29", "2.3", "2");
0
1
-1
bccomp() with negative value
echo bccomp("-2", "-2")."\n";
echo bccomp("-2", "2", "1")."\n";
echo bccomp("-2.29", "-2.3", "2");
bcmod() - mod by 0
echo bcmod("10", "0");
Warning: bcmod(): Division by zero in %s on line %d
bcmul() incorrect argument count
echo bcmul();
Warning: bcmul() expects at least 2 parameters, 0 given in %s on line %d
bcpow() incorrect argument count
echo bcpow();
Warning: bcpow() expects at least 2 parameters, 0 given in %s on line %d
bcpow() with a negative exponent
echo bcpow("2", "-4");
bcpowmod() - Raise an arbitrary precision number to another, reduced by a specified modulus
echo bcpowmod("5", "2", "7") . "\n";
echo bcpowmod("-2", "5", "7") . "\n";
echo bcpowmod("10", "2147483648", "2047");
--EXPECT--
4
-4
790
@ -0,0 +1,13 @@
bcscale() with negative argument
bcscale(-4);
echo bcdiv("20.56", "4");
5
bcmath.scale=-2
3
bcsqrt() incorrect argument count
echo bcsqrt();
Warning: bcsqrt() expects at least 1 parameter, 0 given in %s on line %d
bcsqrt() with argument of 0
echo bcsqrt("0");
bcsub() incorrect argument count
echo bcsub();
Warning: bcsub() expects at least 2 parameters, 0 given in %s on line %d