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.