[php-src] Issue #8291: bcsub incorrect result when second operand precision is higher than the scale applied to the result

From: Date: Fri, 01 Apr 2022 15:52:03 +0000
Subject: [php-src] Issue #8291: bcsub incorrect result when second operand precision is higher than the scale applied to the result
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-240638@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8291 Author: sgurdiel ### Description The following code: ```php <?php echo bcsub('4.102', '1', 2); echo bcsub('4', '1.107', 2); ``` Resulted in this output: ``` 3.10 2.89 ``` But I expected this output instead: ``` 3.10 2.90 ``` Notes: ``` The behavior of this use case bcsub('4', '1.107', 2) should be aligned with the the rest of the functions in the extension i.e. scale down the precision of the second operand before applying the subtraction operation. ``` ### PHP Version PHP 8.0.17 ### Operating System _No response_

« previous php.bugs (#240638) next »