Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103403 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 49815 invoked from network); 27 Oct 2018 04:07:31 -0000 Received: from unknown (HELO mail-vs1-f68.google.com) (209.85.217.68) by pb1.pair.com with SMTP; 27 Oct 2018 04:07:31 -0000 Received: by mail-vs1-f68.google.com with SMTP id 125so1923225vsi.0 for ; Fri, 26 Oct 2018 17:23:16 -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=kntPW5ppc1J7tYFhfwaDLmdoy5ZCi9I62R6cj8U2s8U=; b=G0t2gls6zcp4Ku8wT6xwYi9hzWj0OQ2PqhSipCv+g2373l5Y5hGE81alMiXcFrBR+z GwUk1o8XRg/+sGo0aAUDXeGlrl37tEN187EEKaQAOx43wpj8ZlVbukzA6ygl0B+BqD2U rOCfn94KE40FJ+pgt1tXGrdjqdjpnso+yGavurTflAzTww6WdNp4gqj80NLZG8l4QfPH ofY87vnOoSnoPVmDbV1+FDooRWwNC2ZVp8RjIET8YF5GiIxDnwg51MQxmC+/3/h/MiWX GCmpFjyXeKg9Z0pJZ8Eg9XBrDclVowmUoS6BozB6uE9L9xFJWaKlSh+VqJyk8h9Vsqi7 iNrA== X-Gm-Message-State: AGRZ1gJu4AY4CZd9RskRkweoUKVduKBrDMEV8pY/9jdXkMty44Am4zbc d1FYcZ1mmbiQqblmHaIeyH8LgVfQ X-Google-Smtp-Source: AJdET5cuSCbn8J5FszVWV86HGhYAqoeNAgzfeaZaRHTp5DaNadfLJQv6VizkMSsYV0pDA4KwapGKmg== X-Received: by 2002:a67:cb90:: with SMTP id h16mr2606688vsl.82.1540599795833; Fri, 26 Oct 2018 17:23:15 -0700 (PDT) Received: from mail-vs1-f49.google.com (mail-vs1-f49.google.com. [209.85.217.49]) by smtp.gmail.com with ESMTPSA id h207-v6sm3229703vke.50.2018.10.26.17.23.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 17:23:15 -0700 (PDT) Received: by mail-vs1-f49.google.com with SMTP id k14so1907141vsm.10 for ; Fri, 26 Oct 2018 17:23:15 -0700 (PDT) X-Received: by 2002:a67:e15e:: with SMTP id o30mr1266581vsl.66.1540599794866; Fri, 26 Oct 2018 17:23:14 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 26 Oct 2018 17:23:03 -0700 X-Gmail-Original-Message-ID: Message-ID: To: Sara Golemon Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000083a15105792ad70c" Subject: Re: [PHP-DEV] Extension: arbitrary precision decimal arithmetic in PHP 7 From: rtheunissen@php.net (Rudi Theunissen) --00000000000083a15105792ad70c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi everyone, I've made some good progress on this project and I would love for someone to review it for me? I want to learn as much as I can to produce something as good as possible. if you are curious to see it in action first, there is a sandbox here: http://php-decimal.io/#sandbox Source is here: https://github.com/php-decimal/extension Thank you. :) Rudi On Sat, Sep 29, 2018 at 10:45 AM Rudi Theunissen wrote: > GNU MPFR looks solid too, significantly faster because it uses base 2 > storage, but may have difficulty converting to decimal. I'll fork a versi= on > 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/973ea1719c02a4204dabfe9dffd78c4= b >> >> >> 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 >>> 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 >>> >> --00000000000083a15105792ad70c--