1
0
mirror of https://github.com/php/php-src.git synced 2026-04-13 11:02:55 +02:00
Files
archived-php-src/ext/bcmath/tests/bcsqrt_error1.phpt
Christoph M. Becker 84f2a984d4 Elevate warnings to Error Exceptions in ext/bcmath
`bcdiv()` and `bcmod()` throw DivisionByZeroError if the divisor is 0,
which matches the behavior of the `/` and `%` operators, and `bcsqrt()`
throws ValueError for negative operands.
2019-10-28 12:22:31 +01:00

18 lines
346 B
PHP

--TEST--
bcsqrt Get the square root of an arbitrary precision number
--CREDITS--
Antoni Torrents
antoni@solucionsinternet.com
--SKIPIF--
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
--FILE--
<?php
try {
bcsqrt('-9');
} catch (ValueError $ex) {
echo $ex->getMessage(), PHP_EOL;
}
?>
--EXPECT--
Square root of negative number