Re: [RFC] [Discussion] Adding bcround, bcfloor and bcceil to BCMath
| From: | Claude Pache | Date: | Fri, 06 Oct 2023 08:35:42 +0000 |
| Subject: | Re: [RFC] [Discussion] Adding bcround, bcfloor and bcceil to BCMath | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-121244@lists.php.net to get a copy of this message | ||
Hi,
> Le 5 oct. 2023 à 14:26, Saki Takamachi <saki@sakiot.com> a écrit :
>
> In fact, I predict that many use cases will be covered by GMP.
>
> Still, I think that there may be cases where calculation functions like mainframe BCD are
> required, such as when calculating money.
>
> I am unable to decide whether it is correct to deprecate BCMath and only use GMP.
>
> I'd like to hear other people's opinions as well.
>
We use bcmath in particular for money calculation indeed, and some other things, most of them have
in common to work with decimal numbers.
For those purposes, gmp (in its current state) is pointless, because it supports only integers. I
could multiply my numbers with an appropriate power of ten and work with integers; but in that case
I could just use native 64-bits integers: even if you work on Apple’s accounting, they won’t
overflow.
> Le 4 oct. 2023 à 13:39, Saki Takamachi <saki@sakiot.com> a écrit :
>
>
> After all, I feel that BCMath and GMP have different roles.
>
> Arbitrary precision mathematics and very high precision mathematics are similar but distinctly
> different.
>
> If PHP has already started integrating these things, then of course I'll follow suit, but
> if not, I'm against these integrations.
>
> If I missed something important, could you please let me know?
>
None of the above. As noted, my main use of bcmath is neither arbitrary precision, nor very high
precision, it is decimal numbers.
Of course, bcmath works equally well for manipulation of big integers, which is my second use case
of the library. Because I already use bcmath for other things and I don’t need Legendre symbols, I
have not much incentive to switch to gmp for big integers.
—Claude