Re: Extension: arbitrary precision decimal arithmetic in PHP 7
| From: | Rudi Theunissen | Date: | Sat, 29 Sep 2018 17:25:35 +0000 |
| Subject: | Re: Extension: arbitrary precision decimal arithmetic in PHP 7 | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-103282@lists.php.net to get a copy of this message | ||
I wrote a basic benchmark and GMPi appears to be about twice as fast (+ and
- ops) but produces a different result. GMPi was also running out of memory
when attempting to apply multiply and divide operators. The benchmark only
uses + and - now.
I used bcmath for the reference value.
If there's a bug we can solve here, rather than a fundamental accuracy
issue, GMPi looks promising. 😊
See: https://gist.github.com/rtheunissen/973ea1719c02a4204dabfe9dffd78c4b
On Sat, Sep 29, 2018, 07:20 Sara Golemon <pollita@php.net> wrote:
> On Fri, Sep 28, 2018 at 6:06 PM Rudi Theunissen <rtheunissen@php.net>
> wrote:
> > I've been working on adding arbitrary precision decimal support as an
> > alternative to *bcmath. *I have created an extension based on
> *mpdecimal*,
> > which is what Python 3's decimal module is also based on. I haven't
> > released or broadcast this project yet, because I wanted to discuss the
> API
> > and implementation with internals first.
> >
> Have you looked at GMPi ? https://github.com/sgolemon/gmpi
> It's a replacement for GMP (which includes floating point and an OOP
> interface).
>
> -Sara
>