On 2024-06-25 21:11, Saki Takamachi wrote:
Hi internals,

I've been working on improving performance of BCMath lately, and I found that I 
can get the div and mod in one calculation. This is obviously faster than 
calculating it twice separately.

Do you think there's a demand for this feature?

Since, when calculating either the div or the mod you basically get the other for free (as you've found), and they often go together in use (I have some number of things to distributed among some number of columns: I end up with *this many* things in each column and *this many* left over) so I can definitely see a convenience in this.

Otherwise, if you want both, you essentially end up doing the same computation twice:

$rem = bcmod($number, $modulus);
$quot = bcdiv(bcsub($number, $rem), $modulus);

Reply via email to