On Thu, Oct 12, 2023 at 11:32 AM Pierre Joye <pierre....@gmail.com> wrote:
> Hi Jordan > > On Fri, Oct 13, 2023, 1:24 AM Jordan LeDoux <jordan.led...@gmail.com> > wrote: > >> >> >> On Thu, Oct 5, 2023 at 5:27 AM Saki Takamachi <s...@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. >> > > it is the reason I mentioned mpfr, > https://www.mpfr.org/mpfr-current/mpfr.html#Miscellaneous-Functions > > the challenge I noticed in a couple of threads recently is the mixup of > radically different usages, like financial numbers with basic ops (+/- > eventually *//) and others. > > they cannot use the same tools, most of the times. However there are libs > with different types or mode of operations, which could be a better fit > than what we do now. > > It is not an easy research and priorities need to be clear. > > BCMath is one of the worst and slowest implementations of arbitrary >> precision decimals. >> > > what I was trying to express :) > > > best , > I believe MPFR is what is used by ext-decimal. The only thing that makes ext-decimal a somewhat difficult replacement for BCMath is that one of them uses precision and the other uses scale. (Total accurate digits versus total significant digits.) Fermat has implementations for both BCMath and ext-decimal, while also using GMP. It is much more difficult to control the number of accurate digits in ext-decimal than in BCMath, but ext-decimal is literally hundreds of times faster. I think, however, that Rudi (the author of ext-decimal) was against including ext-decimal in core. But if you want an alternate implementation for arbitrary precision decimals, it is certainly the place that someone should start. Jordan