been years since i checked, but last time i checked, BCMath supports
floating point numbers,
and PHP's GMP wrappers does not (this is not a limitation of GMP
itself, but of PHP's GMP wrappers)

- has the GMP api floating issues been fixed? a quick test suggest
/no/: https://3v4l.org/FQaI4

On Thu, 12 Oct 2023 at 21:47, Pierre Joye <pierre....@gmail.com> wrote:
>
> On Fri, Oct 13, 2023, 2:01 AM Jordan LeDoux <jordan.led...@gmail.com> wrote:
>
> >
> >
> >
> > 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.
> >
>
> it isn't really needed if not at the language level.
>
> scaled basic operations can be (relatively) easily optimized, with an order
> of magnitude faster than what bcmath does.
>
> however, the real challenge, imho, is the different uses. That's where rock
> solid implementation like mpfr could help, for non basic ops or modes.
>
>
>
> > But if you want an alternate implementation for arbitrary precision
> > decimals, it is certainly the place that someone should start.
> >
>
> for the few areas I needed it, I made my own with add/sub and mul/div with
> intrinsics.  very little amount of codes and stable.
>
> I am not completely sure how to cover the different usages, scaled
> operations may be a good start and keeping bc math user land compatibility
> may not too hard.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to