Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128571 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 066BD1A00BC for ; Wed, 27 Aug 2025 13:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1756303091; bh=3oglzIzFjP6lHXuIcxQLqQnJ9SNT3eOpKVCF0JbIkk8=; h=Date:From:To:Subject:In-Reply-To:References:From; b=Ns08yTZM2hvXUVqOMT9cGEH24m2dmGo7nf1khKIxaGmyRbf30w0rHZAgbEbR0it9/ b/qz6zard7VnHDDLQkPWjRW74OUovHp6Mu6BFrVp7m//0Mhb/bre55zItE5Ya4rRwG 0guHgbFeUngIPsFkek4g+mEyQ0u41/yparG6M/V/hSe8PinuKE9gMzwl20x4qXvG7H izkWtKBzUBkOrYlrk1zg4ZbUqtnXtxHrgupq82VQhGHJX+mz5tbyJb0PXUJQCNYr1F eBPjTpn+wraiwvUQ8TUav+1WqeZY/YxycVUQMNSuIGe9k3V4l31XDPEjbBY2PrJJH7 jviubGCCHuToQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9741D180032 for ; Wed, 27 Aug 2025 13:58:10 +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_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-b3-smtp.messagingengine.com (fhigh-b3-smtp.messagingengine.com [202.12.124.154]) (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 ; Wed, 27 Aug 2025 13:58:10 +0000 (UTC) Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfhigh.stl.internal (Postfix) with ESMTP id ADF4D7A00D0 for ; Wed, 27 Aug 2025 09:59:41 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Wed, 27 Aug 2025 09:59:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; 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=1756303181; x=1756389581; bh=XwkuSftCiocF/daB9SHztUIyQf14x364u/ZuIqGT1xA=; b= MaY982EkhIsvK2vLV7mN3sS5M6f+/5uGVS5qaGIkAb+M87ImveakLvB2OPkqnE2o 3gWlamJNV1MxYwHgvogyIQwsPd76ov4cnJG5BoWvAO46KD9ir7gpANKOaxdAXBP1 Bdg//bXKDXhUqn8e4Pg4L+9eEXCoW3Z2VblwoKYoR3FjBRg89mIkIbKYJIhs8Voy fwZ3zEggEZPR3+Tb0VF9eBwAVJYqPGa5/SyqwED/YrdMU5Dc1rk2TPHk7WX0CKqc DsamBPdKZEzNgD9x7c+Zi7iXx0Jot+BPd9niFhh8oWAyNOtWb9uSIaHmh1YeLg3w abPC9XJxdE+aPoEri9S/oA== 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=1756303181; x=1756389581; bh=X wkuSftCiocF/daB9SHztUIyQf14x364u/ZuIqGT1xA=; b=h0LG1w/K3xiZ2Y2/8 IqBOmqKjmPX2nVNsa2LwbvdVMtq6F/W60cyCYY+WOfEaXoSOSifdM9EmS6MC036X zPInqr6kGrYY/VtGauFj8K0dItIC3Og5PgxbhXzgNX5AF9POyBUZdlXWj2ZgE94q X/0rhKMQ2D1Ui9bT9Kj+dRluCmNYmMKPWYkANHiUQDe4F8WZ//oFpeR+sBJLHxt4 p1FgUjEisQFz3YyugcG+wj9dAIIHBPktpc6ciAnHtRky1BVRhP7hpUKOd4JhombP 0V1LnWaqlSNtIeLmJGSqKkH3bdJEPNqt82dTCg4tUah5GIzKib35bX+l4lz+GyHh Etuog== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddujeekfeefucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpeffhffvufgfjghfkfggtgfgsehtqhhmtd dtreejnecuhfhrohhmpedftfhofigrnhcuvfhomhhmihhnshculgfkoffuohfrngdfuceo ihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqeenucggtffrrghtthgvrhhnpeehle ffteeigfevudetfedugedtudevledugeeugeelheeihfehgfdtkeevvefgleenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehimhhsohhprdhphh hpsehrfigvtgdrtghordhukhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphho uhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 27 Aug 2025 09:59:40 -0400 (EDT) Date: Wed, 27 Aug 2025 14:25:49 +0100 To: internals@lists.php.net Subject: =?US-ASCII?Q?Re=3A_=5BPHP-DEV=5D_=5BRFC=5D_Add?= =?US-ASCII?Q?_=22is=5Frepresentable=5Fas=5Ffl?= =?US-ASCII?Q?oat=28=29=22_and_=22is=5Frepresent?= =?US-ASCII?Q?able=5Fas=5Fint=28=29=22_functions?= User-Agent: K-9 Mail for Android In-Reply-To: <499395ff-4ac9-4dc1-86fd-697b205467ba@bastelstu.be> References: <499395ff-4ac9-4dc1-86fd-697b205467ba@bastelstu.be> Message-ID: <97C1F750-737F-4C03-9A98-EC337B9F3770@rwec.co.uk> Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 26 August 2025 19:23:20 BST, "Tim D=C3=BCsterhus" w= rote: >"Surprising changes" is not a meaningful term=2E Keep in mind that the be= havior of the function will need to be accurately documented and that folks= need something to work with to determine whether a report is valid or not = when bugs in the function get reported - which will inevitably happen=2E I think there's a sliding scale of "strictness" of casts, with string to f= loat probably the hardest to pin down=2E=20 At one end, you have "purely lossless" or "symmetrical" - where (string)(f= loat)$x =3D=3D=3D $x This would mean accepting '4' but not '4=2E0', which i= s probably not what users would expect=2E=20 From=20there, you can add some "normalisation" - ignore insignificant zeros = at start and end; perhaps also ignore leading and trailing spaces=2E Then you get alternative representations - most commonly, scientific notat= ion like '2=2E5E10'=2E This hugely increases the number of inputs that resu= lt in the same output, e=2Eg=2E '0=2E2E1' is yet another synonym for '2'=2E Then there are inputs which don't fully match the normal format, but are u= nambiguous - '=2E1', '1=2E', '+1', etc At the other end of the scale, there's the "best guess" approach that PHP'= s explicit cast operators use - (string)(float)' +4=2E2E1 bananas ' result= s in '42' And that's *before* we check the precision of the resulting interpretation= , and how close the floating point value is to the target decimal=2E I'd really like something stricter than is_numeric but more flexible than = ctype_digit; but exactly what it should do is a bit of a minefield=2E=20 Rowan Tommins [IMSoP]