[php-src] PR #18056: ext/bcmath: If the result is 0, `n_scale` is set to `0`.
| From: | SakiTakamachi | Date: | Fri, 14 Mar 2025 00:35:57 +0000 |
| Subject: | [php-src] PR #18056: ext/bcmath: If the result is 0, `n_scale` is set to `0`. | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-31062@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/18056
Author: SakiTakamachi
If the result is
0, there is no point in having a scale.
In the case of functions, when converting to string, the decimal part is automatically
filled with 0 to match the set scale, so bc_num itself does
not need to hold an extra scale.
Even with the Number class, objects retain the scale, so
bc_num itself does not need to retain it.
If bc_num holds an unnecessary scale, subsequent calculations using the
Number class will result in unnecessary calculations.