On Tue, Jun 25, 2024, at 9:11 AM, 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?
>
> e.g.
> ```
> [$quot, $rem] = bcdivmod('123', '2');
> // $quot is '61', $rem is '1'
> ```
>
> The naming and return value scheme is inspired by Python and Ruby.
>
> Of course, if this is added, equivalent functionality will be added to 
> the Number class.
>
> Regards,
>
> Saki

This isn't something I'm likely to ever use as I don't do complex math much, 
but it seems like a reasonable optimization for those that do.  No objection.

My only question is the pseudo-tuple return, which is rarely used in PHP 
(although I've used it myself, I think exactly once), and I think this would be 
the first use of it in a built in library.  (I may be wrong on that.)  I don't 
have a particular alternative to suggest, just flagging that as the main part 
that could warrant discussion.

--Larry Garfield

Reply via email to