[php-src] PR #23967: ext/bcmath: Clear the sign of BcMath\Number results that truncate to zero
| From: | iliaal | Date: | Mon, 28 Sep 2026 12:42:01 +0000 |
| Subject: | [php-src] PR #23967: ext/bcmath: Clear the sign of BcMath\Number results that truncate to zero | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38881@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23967
Author: iliaal
Several BcMath\Number operations kept the operand's negative sign when the result truncated to
zero at the requested scale: the bc_divide() fast paths for a divisor of 1, -1 or a power of ten,
bc_raise() with a positive exponent, and the add/sub/mul helpers. (new
BcMath\Number('-0.001'))->div(1, 0) then compares less than 0, is not equal to 0, and
makes sqrt() throw. String output already drops the sign of a zero, so the procedural functions are
not affected.