Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121995 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 64768 invoked from network); 12 Dec 2023 21:53:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Dec 2023 21:53:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7ACF2180034 for ; Tue, 12 Dec 2023 13:53:24 -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-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.53]) (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:53:24 -0800 (PST) Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-58d1b767b2bso3871914eaf.2 for ; Tue, 12 Dec 2023 13:53:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702417986; x=1703022786; 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=GccXLuofdlPxr7FYcaZhdXmJmH2aVtNOMvKBe9zDAR8=; b=GDlOXdcxxYHLigIchz4rSDoFU8uL8fTdLWUNsmn/TKUllQqZLPSBTDktTeTO7WYyXt KTjctwVqcisQREd0Ni6uLVwEMmyB5iLZgmS06TC2JX+TWgdYDLxg+zmqmlJGLc4SKfwP /c7T52gRX2LElHnBQMJvjh0/XDC+Locrp0h1Mhc8ZRktCGRD6is7dA/jRE1q/4ICp1Q5 pHSTW2XZwyO7BFOH+jezCVIV/QcND/MQpoTH6xiOtAKGw9c9SmYFPMJw5jkdFVGavPwL DoqxAO6jKjBGId0Qs3JPXZahY+3QdtPkVmzjUXoX0xoXvoSkwB5OPrt+Ap0jpyL4Wagt spBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702417986; x=1703022786; 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=GccXLuofdlPxr7FYcaZhdXmJmH2aVtNOMvKBe9zDAR8=; b=PDAZbBQKTZj7YE6uii2ZXnmMd8t6zT8No2MNIOdRAzoQKtwHgBBUw39dspDmtR8hJh RvOFO5VCBURGvudeV8UyVHyrOue+NPSfdgJao6wWKZQbWUU2kTckuzcjHOe9Eo+9fiIP tUd3qecwTjRltoUGWAs3Ovb/gqtuwShdQxxY7mMtAD+SSI6m3CMVtuOUpnXn3yOVIMp3 USvRiGPwyyPmodX4+uyfhgv2PX3LQ0OQve7j+2GjU3tej5bPf6rceWqqR5oaCGw+4q2Y I7HmEN+FMot2K2Qi40yEeZHPQ//ls1LG7NnNLbMQcalg7jhXp7X+O7rzYoc9sX4gv/0m f37A== X-Gm-Message-State: AOJu0Yz788t40Tqd175vJyBc9WAPYio+jffvcXyogkFb4BA5xSYaxdaG RnXJgTmdF8YsXzd+k2UWMnR4mnznOuSH54Q9gVKv12AFp9w= X-Google-Smtp-Source: AGHT+IGnVPXaXTJdAxaOBks8G2YnXBESdwJPoMU+3HeTzLsPn+MFhUjzVmMSuzM0Pg6JLyRplp6Ak119KZb8Gy/EzUI= X-Received: by 2002:a9d:6284:0:b0:6d9:e2ee:3d23 with SMTP id x4-20020a9d6284000000b006d9e2ee3d23mr6093647otk.36.1702417986385; Tue, 12 Dec 2023 13:53:06 -0800 (PST) MIME-Version: 1.0 References: <18c42fdbb30.2831.17a3710df6d58f02ca570cc47e197a63@interi.co> In-Reply-To: Date: Tue, 12 Dec 2023 18:52:30 -0300 Message-ID: To: php internals Content-Type: multipart/alternative; boundary="000000000000567f44060c57137c" Subject: Re: [PHP-DEV] Proposal: Arbitrary precision native scalar type From: ericklima.comp@gmail.com (Erick de Azevedo Lima) --000000000000567f44060c57137c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 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 a= s > 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 just > 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 sounds > > 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 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 > --000000000000567f44060c57137c--