mirror of
https://github.com/php/php-src.git
synced 2026-04-28 02:33:17 +02:00
fad899e566
Added BcMath\Number class. It is an immutable object, has methods that are equivalent to existing BCMath calculation functions, and can also be calculated using operators. The existing BCMath function returned a string for each calculation, but this class returns an object. RFC: https://wiki.php.net/rfc/support_object_type_in_bcmath, https://wiki.php.net/rfc/fix_up_bcmath_number_class --------- Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
28 lines
676 B
PHP
28 lines
676 B
PHP
--TEST--
|
|
BcMath\Number calc float by operator
|
|
--EXTENSIONS--
|
|
bcmath
|
|
--FILE--
|
|
<?php
|
|
$num = new BcMath\Number(100);
|
|
|
|
$num + 1.01;
|
|
$num - 1.01;
|
|
$num * 1.01;
|
|
$num / 1.01;
|
|
$num % 1.01;
|
|
$num ** 1.01;
|
|
?>
|
|
--EXPECTF--
|
|
Deprecated: Implicit conversion from float 1.01 to int loses precision in %s
|
|
|
|
Deprecated: Implicit conversion from float 1.01 to int loses precision in %s
|
|
|
|
Deprecated: Implicit conversion from float 1.01 to int loses precision in %s
|
|
|
|
Deprecated: Implicit conversion from float 1.01 to int loses precision in %s
|
|
|
|
Deprecated: Implicit conversion from float 1.01 to int loses precision in %s
|
|
|
|
Deprecated: Implicit conversion from float 1.01 to int loses precision in %s
|