Re: [RFC] [Discussion] Adding bcround, bcfloor and bcceil to BCMath

From: Date: Thu, 12 Oct 2023 18:26:39 +0000
Subject: Re: [RFC] [Discussion] Adding bcround, bcfloor and bcceil to BCMath
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-121279@lists.php.net to get a copy of this message
On Thu, Oct 12, 2023 at 11:24 AM Jordan LeDoux <jordan.ledoux@gmail..com> wrote: > > > On Thu, Oct 5, 2023 at 5:27 AM Saki Takamachi <saki@sakiot.com> wrote: > >> Hi, Pierre >> >> 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. >> >> Regards. >> >> Saki >> > > GMP cannot be used in any reasonable way to implement things like sin() or > cos(). It is *technically* possible, but not at all reasonable. Now, PHP > doesn't natively support trig functions for anything other than normal > floats, but things like that are exactly the extended capability that my > PHP math library adds. This is required for most statistics, which now HAVE > to be done in PHP itself since the ext-stats extension hasn't been updated > since... I think 7.1? > > BCMath is one of the worst and slowest implementations of arbitrary > precision decimals. It absolutely should be replaced. I have explored > creating a new extension to do just this in fact for the express purpose of > deprecating and replacing the bundled BCMath. But GMP, as it is implemented > currently, is not a replacement at all. > > Jordan > Take a look at the ext-decimal extension if you are interested in replacing BCMath. It honestly is almost a drop-in replacement. Jordan

« previous php.internals (#121279) next »