Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103283 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 90602 invoked from network); 29 Sep 2018 21:37:14 -0000 Received: from unknown (HELO mail-vs1-f45.google.com) (209.85.217.45) by pb1.pair.com with SMTP; 29 Sep 2018 21:37:14 -0000 Received: by mail-vs1-f45.google.com with SMTP id z130-v6so5366292vsc.7 for ; Sat, 29 Sep 2018 10:46:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RYSryI6ceCXeDG0kFXd40Bzkz1wHuuqkBON8lp+NMz0=; b=qhq86gmXAIxb83MvCzkccL0t8S9jIxFFleSeVYMtfNPMK+iWySDcQP/F/H5V750qcK Rjr7LviQQ1P9xo7MQJKe9lb9OtRv/EojrdMUYQ911BPR1+qzcIf9J1Z+I9BzJjAZuo6d 7h9aEDen0h1UamUitHCEr1VqVPFmnfQjTAFnvFPLuiM6ou+WFa/yl5DHk43A57ZDdsHl +jOuVAgmOQDAcc1PTUqz/RS6bVDpJY3YAGvwPHDkhTxyDFmfCKrht4HRxSc96S704uxu TsZVFBaBZyvPChpR9q0djyTkcmddn/GxRI6YHOtUpBOd3Sc32meB4oGGW5DXapJ5uR3u dK/w== X-Gm-Message-State: ABuFfohW91XHv4iVEXmZtE+kLJxfn1bs2tk9NQffplx7U4YS2OVIe6pN NyN682vRCivy0jthKfmwwYX1my5Q X-Google-Smtp-Source: ACcGV60Lxk8WJcnXhk38qeN2O9R79eCtBfrQfmBfiKT/REhWxGonwPajSbT4U7E9/W4lHhFKmVq7Iw== X-Received: by 2002:a67:7242:: with SMTP id n63-v6mr1411321vsc.227.1538243169082; Sat, 29 Sep 2018 10:46:09 -0700 (PDT) Received: from mail-ua1-f48.google.com (mail-ua1-f48.google.com. [209.85.222.48]) by smtp.gmail.com with ESMTPSA id w39sm870891uac.0.2018.09.29.10.46.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Sep 2018 10:46:08 -0700 (PDT) Received: by mail-ua1-f48.google.com with SMTP id w7-v6so3431985uan.9 for ; Sat, 29 Sep 2018 10:46:08 -0700 (PDT) X-Received: by 2002:ab0:3393:: with SMTP id y19-v6mr1614069uap.2.1538243168531; Sat, 29 Sep 2018 10:46:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sat, 29 Sep 2018 10:45:58 -0700 X-Gmail-Original-Message-ID: Message-ID: To: Sara Golemon Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000a379870577062581" Subject: Re: [PHP-DEV] Extension: arbitrary precision decimal arithmetic in PHP 7 From: rtheunissen@php.net (Rudi Theunissen) --000000000000a379870577062581 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable GNU MPFR looks solid too, significantly faster because it uses base 2 storage, but may have difficulty converting to decimal. I'll fork a version that uses mpfr instead of libmpdec and add it to the benchmark. I know using basic + and - isn't much of a benchmark but it's a start. I believe that many projects, especially in finance and science, can benefit from a fast, friendly, PHP 7+ decimal library. On Sat, Sep 29, 2018, 10:25 Rudi Theunissen wrote: > 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. =F0=9F=98=8A > > See: https://gist.github.com/rtheunissen/973ea1719c02a4204dabfe9dffd78c4b > > > On Sat, Sep 29, 2018, 07:20 Sara Golemon wrote: > >> On Fri, Sep 28, 2018 at 6:06 PM Rudi Theunissen >> 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 th= e >> 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 >> > --000000000000a379870577062581--