Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121996 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 69024 invoked from network); 12 Dec 2023 23:05:12 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Dec 2023 23:05:12 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5E8C218005B for ; Tue, 12 Dec 2023 15:05:28 -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.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_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (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 15:05:27 -0800 (PST) Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-6d9e2f04f32so2823111a34.1 for ; Tue, 12 Dec 2023 15:05:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702422310; x=1703027110; darn=lists.php.net; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=FFgfj0svhe1IgSl9samCvDrbUfdxudhxmCS0PhdIRc8=; b=mO7b/kiTLtxzdZ95CyOhibGhH7YVRkeYsH2RaUlxlmJjQVB8jXkt5wE4I8EVe97Z7n u+z/6+6MvuHsOLSwnN2pKYqhtqNr78VkpYUwBnr/w8dlFNNIqjfMWAhbOW7W5beoC6iW hMz1cxlhAm6jtOXx67jeOez3FmfL8xcIfBSRPW2bw1wAuBGRaY22/jxNCd/W/KVID5NC N10ayHdpwaVyRq6fV5njigGqPedtjfMypq790ewVHybY0HdZr7FrjE3MA64FTpzOv4Jq dMIH4EOBAoBFkKtd63Uf4ACFkax39IekvsvO6nPvXXqwqKydhKoduTAekOHXqsx8PAzl e52A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702422310; x=1703027110; h=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=FFgfj0svhe1IgSl9samCvDrbUfdxudhxmCS0PhdIRc8=; b=A2c+1n2tjNuXtIKawRsCC+V5hWOwS2Z8mk8DGFiVqriXEKpbL4s+1zONIvdEB7xQ2h J3Y67Sz/3Loe08oRubnCbyNMnmQNKkflsBJ+i3hRtsvj0rZFrG/6p5wHgJk6i/fxAIu5 7iAU6o08qlFl6wO5/FR6+M6S4DpvmR4Bzhu3PzOsfDXoiz+vfIhZcGqfixrLbTXEUPD9 87BvgKxiE7Zoy1J8DdK0AkFzH6xpyHNb4xvbFtKQsQulopnpVT2lmAJpiFmve+9GjMxL PYCVbEqE/Q5FVKAAvIazUhhp6Iu+Nl1lZkGqotyaT56534t1s7BAaYk6UFVSp0ZaRd2d AfgQ== X-Gm-Message-State: AOJu0YwnDT3S4FK/lI2CMa42cQ+xpdcGoH1DE+Iq3Adn5trk2/s39R3w 5I7reH3OuUL3nBnybkwfSe+3QxMWYNNUB2ut9yvawsHwDTS3sQ== X-Google-Smtp-Source: AGHT+IFPmMV0rLjZD4egeWxAxB7YJXJp/b2Z2yXZprKX1O/jZ97+xZnwGl8ot/gIPsZZ6GmsRDOcDvLGVlwQhrMiGVM= X-Received: by 2002:a9d:7a96:0:b0:6d9:da80:4295 with SMTP id l22-20020a9d7a96000000b006d9da804295mr4414792otn.55.1702422310331; Tue, 12 Dec 2023 15:05:10 -0800 (PST) MIME-Version: 1.0 References: <18c42fdbb30.2831.17a3710df6d58f02ca570cc47e197a63@interi.co> In-Reply-To: Date: Tue, 12 Dec 2023 20:04:33 -0300 Message-ID: To: php internals Content-Type: multipart/alternative; boundary="00000000000010a864060c5815b9" Subject: Re: [PHP-DEV] Proposal: Arbitrary precision native scalar type From: ericklima.comp@gmail.com (Erick de Azevedo Lima) --00000000000010a864060c5815b9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Oh, I just realized that I used the wrong word, so let me rephrase that: What's the name of the library you're talking about? Maybe the *pros* of a core implementation can be highlighted if we can see the limitations of a user-land approach. Best, Erick Em ter., 12 de dez. de 2023 =C3=A0s 18:52, Erick de Azevedo Lima < ericklima.comp@gmail.com> escreveu: > Hi Jordan. > > What's the name of the library you're talking about? Maybe the cons of a > core implementation can be highlighted if we can see the limitations of a > user-land approach. > > Best, > Erick > > Em ter., 12 de dez. de 2023 =C3=A0s 18:35, Jordan LeDoux < > jordan.ledoux@gmail.com> escreveu: > >> 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 >> behavior >> > (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 jus= t >> not >> > 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 >> until >> > some point when it renders down to a float (eg, on print)? That sound= s >> > neat, though I am nowhere near expert enough in that area to say what >> ugly >> > 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 issu= e. >> (Algorithms like `sin()`, `atan()`, or `exp()`). It's not an unsolveable >> problem if you really want rational types. There are libraries that do i= t. >> But unless there's someone here volunteering, it's probably a non-starte= r, >> as that's something I won't touch. >> >> Jordan >> > --00000000000010a864060c5815b9--