Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121960 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 61247 invoked from network); 8 Dec 2023 09:14:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Dec 2023 09:14:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4DD1918004F for ; Fri, 8 Dec 2023 01:14:36 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 8 Dec 2023 01:14:35 -0800 (PST) Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-5d7a47d06eeso17934777b3.1 for ; Fri, 08 Dec 2023 01:14:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=interi-co.20230601.gappssmtp.com; s=20230601; t=1702026861; x=1702631661; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=flxCofHHH3jP+F8cX0M+urWOjJIBKjXHwrQ+ySg+fI8=; b=UMSzG4kq2SfeDTGcGRTj/N1K7KQAG2a9zBywreAyU3umm8gCvAExi+TTz3Lakv2QL+ qqqylLbtMBohvPxCRSnnPwDN8QTDJzQOIAivQrsE7Mk6HJp6MKYRzXyWqqE0RfHrshxc bejCx3YD+AV+NjDUQYEs97GxTtYuUHCUw3VfHBeiCLM0YTwJzPgdEtbFVMgQGkEKmfkh n7eUfMrIKh/MGzQbh33RaHpCcRKIJRC1vdLQdQRhS575GhXMMjdUYiahhfN48C7fJckv lLpJl2fEB25LT5WGGZ0OYruX89mfW5n0cyWqWcrZDU9IGHe2E92vK9KnlATCH2rAp3XN H6ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702026861; x=1702631661; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=flxCofHHH3jP+F8cX0M+urWOjJIBKjXHwrQ+ySg+fI8=; b=WUZQzdpaCRM9vwhJDY4tDn4DUP0JL/jtZhJDE3UuEvXgQtyyKQ5bcn/4KtuiRlH7nc iNgnD5R+ZaWKnUgxIs4tqTN38w0l6PqK0m/5wCSOD/n9dZ4Samzo/SpXPBrwN5pSjK36 h+7tgwha68vlMkAiNS7svH9daz/r53dk6XOkZTdc9MRyAaZ3ZncIGhSokNu//GUUvNdm 3l+afz9ZgGuXxRpZMn1uQiXAb8V6QSotM9+Mpwa85zzrxM3XGfG+kBEthnEr4/V23lrs 7uX76B2PNsjPx2ytj2bS0PuPZpXwfLLYaqvzoEsKhJmSGVVvnRk4+Oo0Wegb9FESbLA7 FwtA== X-Gm-Message-State: AOJu0YwDjfcX07WXpmTuhB+BH9fU1R1fhz8iY+q+9aJIU2OfcwbAcdIa aJErQZZjpF/qMtnWu/P3lRTXAKtGVtR4Bkfwcp8MvQ== X-Google-Smtp-Source: AGHT+IEW1kEyQ3dqkj3+ohZbU3A8/LRP5/Y8yBjvBHu7g143m95vcGQWuy6mWIL1P6UZmL8OKmtmS26hn0jLDDy18Ao= X-Received: by 2002:a81:9a8a:0:b0:5d2:5caf:759 with SMTP id r132-20020a819a8a000000b005d25caf0759mr3604109ywg.22.1702026861423; Fri, 08 Dec 2023 01:14:21 -0800 (PST) MIME-Version: 1.0 References: <18c42fdbb30.2831.17a3710df6d58f02ca570cc47e197a63@interi.co> In-Reply-To: Date: Fri, 8 Dec 2023 18:14:10 +0900 Message-ID: To: Jordan LeDoux Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000794221060bfc0266" Subject: Re: [PHP-DEV] Proposal: Arbitrary precision native scalar type From: alex.pravdin@interi.co (Alexander Pravdin) --000000000000794221060bfc0266 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Dec 7, 2023 at 11:27=E2=80=AFPM Jordan LeDoux wrote: You are going to run into some very difficult corners on this one. For the > last... 8 years i guess? I have been working on an arbitrary precision > library for PHP in userland. It utilizes BCMath, ext-decimal, and GMP, > depending on what is installed and what kind of operation you are > performing. > > So, the functions that currently accept floats include functions such as > `sin()` or `atan()`. These functions are not at all trivial to do to > arbitrary precision. In fact, the VAST majority of the work I have done o= n > my library has been to handle cases like "What do I do if the user wants > 2.921 ** 4.293810472934854?" or "How will I guarantee the precision that > the user requested for `tan()` in an efficient way?" > > Now, libmpdec is going to actually have implementations for most of this > stuff that you can call directly, but if the PHP function `sin()` isn't > capable of *outputting* a `decimal`, then this isn't really that much of = an > improvement over the current situation. I mean, it's still something I > would support, but that's the area where some help from the engine goes a > VERY long way. > In my proposal, builtin functions are capable of returning decimals if they're fed with decimals. You're probably also going to need a way for a user to grab certain > constants to a given precision. I would think e and pi at the least. > > I have a lot of experience working on this problem space in PHP, and am > definitely willing to help. I looked into doing a libmpdec PHP integratio= n > several years ago, but decided that voters were unlikely to give it a fai= r > shot, and so decided against it. If you're willing to try and roll the ba= ll > up the hill though, I'll definitely help you. > Unfortunately, I'm not an expert in precise math. I definitely need help from experts like you. I appreciate your readiness. I understand that there are a lot of edge cases. I would propose to implement basics at first and then decide what to do with edge cases. --000000000000794221060bfc0266--