Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121994 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 62835 invoked from network); 12 Dec 2023 21:34:52 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Dec 2023 21:34:52 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E689E180031 for ; Tue, 12 Dec 2023 13:35:08 -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=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-il1-f170.google.com (mail-il1-f170.google.com [209.85.166.170]) (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 ; Tue, 12 Dec 2023 13:35:08 -0800 (PST) Received: by mail-il1-f170.google.com with SMTP id e9e14a558f8ab-35f71436397so919115ab.3 for ; Tue, 12 Dec 2023 13:34:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702416891; x=1703021691; 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=DYD8MNoV20O3pmIVh2t+vQ7loxACZvFqsXDyeB3ck0k=; b=FC4nJxWJ6aurxnQw5mWBuMMZHumj3QjV1VGIW9jSjHnCQKtB1I5JokIFwCx85eaGDp 5/aCbZLVxDTQlgMPOuLZ+1RSPtS+kVZRaSlZqRACxaHmmxjXjImwjWHTukI4yYn6MceT 0RGF49vsmavAnOELiBkr69ualnEp5F99DVpXb+IgqsIyMD/MuRAE7eCRFap2C1xQEzKg ryFDjC5OYS1ypY6M5VxjTMlDvcG//ql97kMeth/w2lCROCPrrzsvwpvZgSWBgtiO3r71 dK/4BJmUcHw3zDKosxOMTR73/MYSbj+5BPTPNQ3dk9FyyE3QR5e5f5gfK1un/41iEqgC 00AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702416891; x=1703021691; 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=DYD8MNoV20O3pmIVh2t+vQ7loxACZvFqsXDyeB3ck0k=; b=HbGgYxI27bBcTtOkJ6E2jenDuDiRhrnKggVhcELrJ5oqicAZiM+RftMnu8teVoAkcq OZ1nB9vxnkjcw07agNfnWSvTO/Pd34+HWxYHgoVaiIGV1/UuXkh9+3muienJbwQMWoHA Gw5ZT+6NKXjV+mXZEx0n2y/wJWZLKEYg9VijbO5f40S+9gIBLxRdS8PQLJiOEdfRq+Gf 9oTRdGa/mK/DbzJ+YKnrw9iJRrWHKYyCcFPgHwEf/towKmPvRPqrVKkZJXAm8XOrImCa BmtNON1WixHnbCdMaI+IrlrVI6//5PfztnxcM6QlJUyAQfuIfgyRgkOmSolATXCrBwOe VI+Q== X-Gm-Message-State: AOJu0YxIywLQuA5LUnBV7iNXF9isgqR/i7KY2C1L7OC/NfUNS1+FwXpB dvoLxG49/WmC4/oAWYZ2xEQWbOXGPxdBOIc+RppSpmPn X-Google-Smtp-Source: AGHT+IEwx23BPMHrsAXCVlWLIc1b2ZSrpUJa9pCex2zmcFOB48F1T2RV+lhZ1OvBbBndPnw+11xrTK9Yjuc5jDmZwts= X-Received: by 2002:a92:c268:0:b0:35d:701a:bc66 with SMTP id h8-20020a92c268000000b0035d701abc66mr10106491ild.62.1702416891385; Tue, 12 Dec 2023 13:34:51 -0800 (PST) MIME-Version: 1.0 References: <18c42fdbb30.2831.17a3710df6d58f02ca570cc47e197a63@interi.co> In-Reply-To: Date: Tue, 12 Dec 2023 13:34:38 -0800 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="000000000000121e1e060c56d260" Subject: Re: [PHP-DEV] Proposal: Arbitrary precision native scalar type From: jordan.ledoux@gmail.com (Jordan LeDoux) --000000000000121e1e060c56d260 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Dec 12, 2023 at 1:26=E2=80=AFPM Larry Garfield wrote: > On Tue, Dec 12, 2023, at 1:03 PM, G. P. B. wrote: > > > The issue is that I don't think having arbitrary precision decimals as = a > > core language feature is a necessity compared to rational types. > > A cast from rational to float wouldn't produce a large round trip, > whereas > > trying to figure out arbitrary precision is more difficult. > > But in any case, having a declare/INI or whatever that changes the > > behaviour of the engine/language is not a good design choice. > > I don't have strong feelings about arbitrary precision decimals either > way, but I do strongly agree with this point. Having the language behavi= or > (including the precision of numbers) change with an ini setting is > long-understood to be a bad idea, and we've been trying to phase it out. = A > decimal feature that relies on a language-affecting ini setting is just n= ot > going to fly these days, IMO, and rightly so. > > I am curious, GB, if you're proposing an actual `rational` type, which > stores values internally as just numerator and denominator separately unt= il > some point when it renders down to a float (eg, on print)? That sounds > neat, though I am nowhere near expert enough in that area to say what ugl= y > edge cases that might run into. > > --Larry Garfield > I agree that an INI setting or declare is wrong for this. The ugly edge cases on a native rational type tend to be in complex algorithms, which many libraries deal with by converting the rational to a float or decimal for those complex algorithms and just avoiding the issue. (Algorithms like `sin()`, `atan()`, or `exp()`). It's not an unsolveable problem if you really want rational types. There are libraries that do it. But unless there's someone here volunteering, it's probably a non-starter, as that's something I won't touch. Jordan --000000000000121e1e060c56d260--