[php-src] Issue #11214: Add rounding capability to bcmath functions

From: Date: Wed, 10 May 2023 07:54:00 +0000
Subject: [php-src] Issue #11214: Add rounding capability to bcmath functions
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-244412@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/11214 Author: stollr ### Description Currently the bcmath functions like bcdiv, bcmul, etc. cuts all fractional digits which exceeds the scale. Here's an example: ```php bcdiv('1.25', '1.109', 3); // 1.127 bcdiv('1.25', '1.109', 2); // 1.12 ``` This is often an issue. I am using the bcmath extension usually when it comes to monetary calculations (taxes). It would be great if those functions could be extended with a further parameter to define a rounding mode, like for [round()](https://www.php.net/manual/de/function.round.php). What do you think?

« previous php.bugs (#244412) next »