Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128561 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 4F51E1A00BC for ; Tue, 26 Aug 2025 14:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1756219650; bh=vB7ymKqmaKgzuHJMlPCZkGX1hCY6KP1s2ylssOKbJWU=; h=Date:From:To:In-Reply-To:References:Subject:From; b=hb9xKHQ8bxO8OAD3RC3Jz23W4Jw0xd+evfrgfCwAFL0oviRTY7CX51cuZaktLFXcG BpwPhGY7kDhg55px6pI6Eys8mJm6Vu8Rvk4CPsOIifgOpnwa4FbtQRLwY3BblRhsjG 6geMi3MOLM1EnIVOcKGluMPrfXQOfH/PW/ENRxRSGNtyZPrW0PiFMMJhB/NCELMDaQ 3TvYXzDh8NU21Nd4VkozmH0YgvrvZbpbYo7DwWY7VY+kti4iHAAEzk0h0AJfph0zer 2jW4H307644b4jjTJ07RGT/WV8/Y9daTKUyhBIevg7LcfsD9hY44Vxqebrp1r4FVMn 6WrrwuVgQfRyQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A0367180084 for ; Tue, 26 Aug 2025 14:47:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fout-b2-smtp.messagingengine.com (fout-b2-smtp.messagingengine.com [202.12.124.145]) (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, 26 Aug 2025 14:47:29 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfout.stl.internal (Postfix) with ESMTP id 7C7161D00185 for ; Tue, 26 Aug 2025 10:49:01 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-10.internal (MEProxy); Tue, 26 Aug 2025 10:49:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm1; t=1756219741; x=1756306141; bh=vB7ymKqmaKgzuHJMlPCZk GX1hCY6KP1s2ylssOKbJWU=; b=V4OFJYnNsQmT/YKYeAwylMlvEvRC+conilA1q 9vwiDQy4FyD1U9s9pEg3rkGQzzLLNmGafw+LPzP7WZfI9VcrUFI+PjLf1enodMB7 EaxbY04NwigOxzYN1CUabo3SaDNmzR8kWCr+EHMwmxarXOmI5HMrS32MLlqpqRLY TkC26fl7yAks4wuVTCMXIYbbVHeh6091248JC9anIXKPcigm6GAiqOR23rF28Vc6 LxN94lgGjSTL6B54m5Tc075DxLWWnAuhqhAlaeC0s0GSox1CmNlIrLEeV3KuMQ0O 4NPR/guu5RGQrYiV8JqSWbdTCNetb1VveZ7mMQWomJ5VC/oZg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1756219741; x=1756306141; bh=v B7ymKqmaKgzuHJMlPCZkGX1hCY6KP1s2ylssOKbJWU=; b=Kem9O4hN0mQZLVSA0 CQoo4rK17s4/zLT9RWmYnWcEGc7/3vks9+xs7+heN7o5SA7Bk45rNT27mCQfV7Fx 7Pux8J6VpkNM7kzKOpdybv9wfCDhwYi1JM8y1ELjiQdzs+PslrGW2gBZLOS8/c0F Z0V0ati9t9cIJitnjSxXD6BDt0XAmaBbSCPkzx1bl+8NVBayhz0MExX3LRB6+xPC EORPCOJHl+C9g5T/aYfBrSsb/IiUEZtcmNtjtfVNjYXc51R3P6HZZjEw5T7g3hJF 7NyE5dsEZ40OWekwHGUDAB9/1Ik0LbUH4MdnnUTEg/cidVjbHukcIHra5ZfSljwC 22EaA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddujeehheehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvffkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfnrghrrhih ucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqe enucggtffrrghtthgvrhhnpeffieeivdfhvdeguddttdegteeiueegvefhteehfeeffeet udeitdehtdegjeeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomhdpnhgspghrtghp thhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsh eslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 0EC3C700065; Tue, 26 Aug 2025 10:49:01 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: AuIX-eojstS3 Date: Tue, 26 Aug 2025 09:48:40 -0500 To: "php internals" Message-ID: In-Reply-To: References: Subject: Re: [PHP-DEV] [RFC] Add "is_representable_as_float()" and "is_representable_as_int()" functions Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Tue, Aug 26, 2025, at 9:30 AM, Tim D=C3=BCsterhus wrote: > For `is_representable_as_int()` finding a reasonable definition is muc= h=20 > easier, but I don't think I've ever had a use case where I needed to=20 > know whether a non-integer value is exactly representable as an int. > > Long story short: What actual real-world problem does this RFC attempt=20 > to solve? The list in the =E2=80=9CIntroduction=E2=80=9D section is no= t particularly=20 > meaningful with regard to the real world and the JSON example is wrong=20 > as outlined above. > > Best regards > Tim D=C3=BCsterhus I have multiple times just recently had need of "I have a numeric string= , should I cast it to an int or a float?", for which an is_representable= _as_int() function (or similar) would be quite helpful, and neater than = the messy solution I usually use. I haven't had a use for is_representable_as_float() that I can recall. --Larry Garfield