Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128563 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 42F911A00C1 for ; Tue, 26 Aug 2025 17:16:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1756228522; bh=ODXe12gLtKakSwhOzseRbuIQydKY97tuh4oqrx2P5pQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=TUr2QAwr+EcP9L2nQCdPQpSlMwExz6sKjcYoKGVhLN3L2jCdWcIpHbwxFvm1NueGQ 5D8rHIgp+StNjrcT3fUJL/XaTZB8kFrnurPP38fcJgArm3L1V5AUaBRC/r1IIf8bLW guc1wHAwOFKSCIN4z86vXeXKtDF84+YavnLi+LkfbQDuSCN3+X8nsr+Kzfy/OBtn6b SmYFwLRvEX8gZZOUVKYs1ZY5p1wWzVs7MRYOJPG6TPTDPbgx2t5F0sn8mDKcdUE8gi IyLqvFFyhF9O+6ZxDJ3HuvjUYrk9U5Jie6AzhX10kQtjOFUzNLOOcxdSPbRk7wwszd oHG6Q/q0QKzoQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D2DD3180086 for ; Tue, 26 Aug 2025 17:15:20 +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=-0.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (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 17:15:18 +0000 (UTC) Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-61caa266828so510255a12.1 for ; Tue, 26 Aug 2025 10:16:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756228610; x=1756833410; 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=ODXe12gLtKakSwhOzseRbuIQydKY97tuh4oqrx2P5pQ=; b=J7U9rz7gwvkU8qHPQLb/mxI22ZFx14PgOp2KXMO0Dt2pCNCho3njsbqzEyTHDIOn1n Gle1dLwSrcwakQft+LkwPrWsQyl56jqVaRJ1BVsD/wQx7zBn5EwtWTaJhUU3E/U3dWmF +SlD9BDWYwDenDQq2TsOe6oUWhv6OWvpOjftflFYM6Y44dZDZ2fwy/5dA6Lo/97GE7xO vyt4njCGeQA7ancDeFIii7cnQ9s3cFQd6aRWNF3lgARb7mWIMtG17nVIAZMBvZZxURof w9DWDgVByOx+yloGgmSxZxMAYyFB6rayhbQOGGtTxC/3gql1A6DHgS9e/PexH8EIZ5IR aZgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756228610; x=1756833410; 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=ODXe12gLtKakSwhOzseRbuIQydKY97tuh4oqrx2P5pQ=; b=DDIOdFEs0+eEfQS2PQboRMD0qxP0Ht3CsPcKntzmxhnmyzTA9bJX+3SUAXtFMyEeX3 K9aMoEeC6kDrQ2vngwQJ8G/aorgXG++Pi/ROLhCq8d/qSxBiVjnJPBW+agPcIzPDI4Mm 5yyzN8qmczF4W0+WncB71sNAoPHRvxLj6R/DZcaPHKIzYMwqritZ7iruXT+oAtLQ6738 5T3DpxACiPs29fS4S/JNWSrCgZNDfAVMjMLT/tlIfz5a2Pl0f9VpRNLQVtVFjFgc/Re1 aLIA6KZZbcGq8DOlU67pxWwLvbiKNJSuhk/FVfZ0LdMYoTBs+B7UlKbSVGXr5zCPKWbu rW5Q== X-Gm-Message-State: AOJu0YylkXt8yHePO5AT9nbVxHrZOcdAOf7MqDa44+DwFzzUkoguA0OT TbbiQnPeiFLqSbQclykkUtGpP4VhzTuu2A8gl4vjInCxVK6G55AzpQB9x1i/GIkQGfsnr442oGc LIVNcAQDOCUPiZiUbVRZVvmlOaxPznQhkcw== X-Gm-Gg: ASbGncvVpkadT1gSazawK7bT8KQlR7fCfxDGKA06J3stt/MdTlcoc9zhTlay+Y4Vd7t H8bkR+DppmTGw6+bE/vap2D45qdNpq8FfIZo93tITOlYasAoI9Y79nlbdUWTlrC1X/NTsqdUlIy 6HOpXO6BNDLX6yYC8jQFNgWt1ejj6g4nP31sTE0NSDUsxtGXIS8nsuEWvZ745j8we8rLar9Hc3C YhDDKpeiIFAvTVkvT89qyWS1Hq7hmEfCapKluD8x49i37y02q4EC4Zk2QZmXsBpc5INyEI8XQ== X-Google-Smtp-Source: AGHT+IEm8/hAy9w+yk0BPlH3uJFUN7YRXo3hWQv71wYq4cTQCwhlwhxUPPesW3nsuITyDc5N7XIb7G7isvMnaI/SOUs= X-Received: by 2002:a05:6402:a0d6:b0:615:a7f4:da26 with SMTP id 4fb4d7f45d1cf-61c1b492fbamr13524488a12.12.1756228609941; Tue, 26 Aug 2025 10:16:49 -0700 (PDT) Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 26 Aug 2025 19:16:38 +0200 X-Gm-Features: Ac12FXz4cAEnukrkUH15FgBERguzGiRh-lj9iHwuZxxXMMEGqTd3McJlo85IwjI Message-ID: Subject: Re: [PHP-DEV] [RFC] Add "is_representable_as_float()" and "is_representable_as_int()" functions To: Larry Garfield Cc: php internals Content-Type: text/plain; charset="UTF-8" From: alex.daubois+php@gmail.com (Alexandre Daubois) Hi Larry, > 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. Indeed, this is a nice use case! This is also something I encountered a few times. > I haven't had a use for is_representable_as_float() that I can recall. Just thinking out loud, if this RFC ever makes it to the voting phase, maybe we should have two separate votes, one for each function. Best, Alexandre Daubois