X-Loop: help-debbugs@HIDDEN Subject: bug#59531: 29.0.50: An alternative to `string-to-number` which throws an error (or returns a NIL value) when input is non-parseable as number Resent-From: Ramesh Nedunchezian <rameshnedunchezian@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Thu, 24 Nov 2022 06:21:02 +0000 Resent-Message-ID: <handler.59531.B.16692708586362 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 59531 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 59531 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.16692708586362 (code B ref -1); Thu, 24 Nov 2022 06:21:02 +0000 Received: (at submit) by debbugs.gnu.org; 24 Nov 2022 06:20:58 +0000 Received: from localhost ([127.0.0.1]:56940 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1oy5bH-0001eI-Nr for submit <at> debbugs.gnu.org; Thu, 24 Nov 2022 01:20:58 -0500 Received: from lists.gnu.org ([209.51.188.17]:51612) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <rameshnedunchezian@HIDDEN>) id 1oy5bG-0001eB-MP for submit <at> debbugs.gnu.org; Thu, 24 Nov 2022 01:20:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <rameshnedunchezian@HIDDEN>) id 1oy5bG-0006W1-HS for bug-gnu-emacs@HIDDEN; Thu, 24 Nov 2022 01:20:42 -0500 Received: from mail-sgaapc01olkn20821.outbound.protection.outlook.com ([2a01:111:f400:feab::821] helo=APC01-SG2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <rameshnedunchezian@HIDDEN>) id 1oy5bE-0003Y0-Fc for bug-gnu-emacs@HIDDEN; Thu, 24 Nov 2022 01:20:42 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qn/nlnyjIPHDDsaLtoGfCx1Igtf2G8OVKpTVz8LLDZb7s1wvsEZFgk0hYqtdifbYIkrPbRYUUok1gC/uI8LT9JuJ8K1Gfamg3rrYI/LCX3b81FTxxdY9fv7DpNLG9LuvfGqQyld5IHNOyVZOSL5Uyo4i6+S/rzz9KISc5Mz5zJJ/Ig6rtKjNPZdTuoYs3Fp/zaw9rWy3+b3/4HHtqasOAFVl2NrKWdM7BTONHUjoq4/N4ZL6j5+C46VXGl/O5o/gIlk7RyrxcyX2en6YluvCs5IrCZ/RgOdAcTy40dPicsHI7MQzcFyfp8kz+LtlalC+sV67nWXaqnRNhZY+TYHNsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Q4UdU0FOqDmmpJEPNWXYetuqXjCP7P/W6CXQi/lMnwk=; b=mIQPlkLmxrgHIbzd5EioyTAa3tWMsfBPDdVNyNrhervoRvV//Mq9uQUNk2pSl6Rxo0PXCnrGARsOSKAQJQGuGkptj26ToDyj2U7+waMz9FLFQoyHB31SZOHwgFRRV0zDdboky28G6aqpBO8NbbqQ9eeMWsoEf4nSixhByLwCQ+3cmljIPyKcH35adg1/EjvpGl0ddWAt1yvFSbIa+xCBbDiVgcWo7ZzMEYZcZVDjDqoKsmtC1mzt3hjQ5FLbU7D4p6B2gknQM1ELGTVlAmeqlpRl73F9ArQxhz771o9pzVNBJIxwOdL0J4I/vglVPC7fUN+p/aJaoeJlHG9TL78WiQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q4UdU0FOqDmmpJEPNWXYetuqXjCP7P/W6CXQi/lMnwk=; b=HHsjvBE6OoQlyr3qtrJmnK3pIrpDyssjNVez6XPHaO3nXhya41EABt28MYFmnVk9o0QcMIoghmxLR0qjqWUtTiN4d4fsHF1I4NPC3Tlfl6QN1fMdezVSiRFEeExMwSV/bgZ71fKQCfIKOCWFTQpNbFHHjBvUrxHyMUQUUFYHik5nDC3Z4etaAL8YfXxDAt+bRrHDJ905ZdrX84ogUeLRvZ1jApK/j4KsGUQPgxph1rOz6+6A9+Xm7YGRRQhJhDMOuzTIkzQJmohx2IVnyxNtfxwPwQ1NOvUZlVI7D6QRNq8/ZiA5+XX1oqjizTNFpY4rWh38tkc1gUs6XS4a0VQCXw== Received: from TY2PR0101MB3693.apcprd01.prod.exchangelabs.com (2603:1096:404:800f::16) by SEZPR01MB4208.apcprd01.prod.exchangelabs.com (2603:1096:101:4e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.19; Thu, 24 Nov 2022 06:15:33 +0000 Received: from TY2PR0101MB3693.apcprd01.prod.exchangelabs.com ([fe80::43e:15e5:fd5b:c74a]) by TY2PR0101MB3693.apcprd01.prod.exchangelabs.com ([fe80::43e:15e5:fd5b:c74a%4]) with mapi id 15.20.5834.018; Thu, 24 Nov 2022 06:15:33 +0000 Message-ID: <TY2PR0101MB3693F7DD75CC1CCBA0EB9543DA0F9@HIDDEN> Date: Thu, 24 Nov 2022 11:44:43 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 Content-Language: en-US From: Ramesh Nedunchezian <rameshnedunchezian@HIDDEN> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TMN: [91vZ6UC1AX3dd2WyAd3jVC3HO5t4ePBv] X-ClientProxiedBy: MA0PR01CA0020.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:b8::8) To TY2PR0101MB3693.apcprd01.prod.exchangelabs.com (2603:1096:404:800f::16) X-Microsoft-Original-Message-ID: <6abfa53b-b972-df64-6512-05e72a2c11e9@HIDDEN> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TY2PR0101MB3693:EE_|SEZPR01MB4208:EE_ X-MS-Office365-Filtering-Correlation-Id: 80473c28-1d8a-4c17-988f-08dacde34b31 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bnH49IYX/dPWhm62IJ57unnuJ2j+rPiwdB9TpaUmCKvEVIWPEgn3qCRr2B9wfRD6LZeFpL1lFTgISZgsgr9Oay/d6Wo4vtRGdYSvS51yEFeOPslD3GBxKs4DZeQtgDt5T3UEi46l6W4IXcd4dBuCHgFFwTlwcZvczAwhqGwLFMoxIYtpVk6LWXANX5ftcxh+PkPoR0jqq/BvWpgrMJ3BjpbrNZil5vsXpqIlCMpCMOX62AOrnF2BOMLfcQV86s+eEUkvcKD1h0zvT+UbkLAc+lcI/8mc7uB5IRzYyYXpR/x3HWUSQ2c9gDKWr4A7A2xKiH3zyo+6W0ehYBrxJGN+u9W88jH1q7UXxhf9xiGG92TqNooOY7llY5SPw0saL9SHuWes8LfYwDZQy5NEsTkmt9L4g/0TxUOS9aF5nWwwJh93l5GSHDPO0SAirDz/qt6VWXmU41Kiim6F5x5i+Homhx7pfH1zfIX+V+htSgMdYXgWsEW3reHQt/vT0V3rgkZTXQCvgDJ7wVKWlR1+5VoebR2eWEfeWqy5r5EYlx0N2i3BofUFGe8PksjyebRu6HEJ/ldus2/vlAUwoxfEGq8dtSTplA6FZHywSnzIaaV8eFg= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: W6zI1DQCagzDK8obE1MTUj/C9Ca5yRgzPvTT7w7a3/Qwdbz51V3WW0tMgyOnZX+OZeSVHRfITDdb8VaPshvnXb+c4ESCs5RA42ayN4j5+Tba9am6G0jlvzfISD550B/bW1jbDB53869D7qhp823AobPmnGcQkpG7ulSSRn5SZsCemCKiR2dogWykgtx4E5seJJW0Fruj6o4y5I8fxDlOvLjHuEeWzoEkstMGtn2JFf08W1/jLHOxluuEkRcPfdwxBvW9nby9KMgj0CUeXTrS3rDbbu6PzEaJlvhkyMRzBABCuIZ28Uh7dCWpj9SNHt9eQbfVZPnfotosrpm9J+liumQAs16pLtfbyT7uzehVqwgqu3EnS1eedj6w6b+IU86zQsal/7+9CVt1DACkMlTTO4Y85CIkmHmTVKBONj6sNSMVFcA+sjjM4pOZOotiA3+qoe61K2vx2bpNRzw3fmpn93J6zebrrne+zdQdF/bS3ON8dAF4uqVnVaRD01vQVGZw8v7f9Ttmlgmk/IADGnzfqiMCDLb3l3psrsRE0pWm3HdmvZeDRIpy+BB81hRb5MZtmPImmfyGAN6nmzchcd/SIH020Kb8QwAOnRYgazmJNog+0L6ygUiYNqg5ixS44o1HH7G0gDr3z0fBmtv5/c/8TOmcmeJWIl0P5awhr2oNaip3LEXaQ3LkEiAcUdzloJIF/odhe/jMlxaAuiB2AlfDdEZXC+eXzJ92KrvMWqI8qZ7G2dF/1LLKG7sSJswjHDajNK1LF2qsLIgZhOxPZu1SWXV7zBN7PjiVbtVuSn7p6p02VMT9LZkjgr4TkqQrepjJHawByexJQyKDlDC/ZdRZ3v83J8M67qb7TALWBKGFr69GKnT+yt42V5XpztGZC9qGmQutU9/Y67ux1wHilY5AhhGFMz2Be7487iEQzLUG0l63ya5PLovIwyvp2J+ULpcf65T/FaX91SaSElIu9If0b7R5dqgNB8JNhm79h0m+CB9LPHdeybqnrOngxnGHVJrY0yCQX1RbbbZZLhuvvMD/nxlcbCUQ4v6IYW5DJzG3FeiAPJbukFtBxgwcCAnqYi7tCMPe1RmJLPoYZljIvtlf7xr8rBQpcLXEyxvzmW6EeX5uC3w1X4qP2LI5w6lbf7j9q0cF87dGwEEi4g1z4JJdCUD8vMNtRKeP4tHbDh/0OZiAmLy4H13qHj6g+X88WjffVel59EbTGtiDOHIcHOxxVFtxpqwpDQChhuF88S9HsHr5n8fE4deA4EfjFecLligN6qsN1WSkUrFAX8XdBIq8KH6R/ZdquyxXVh4Fvl5KYbI= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80473c28-1d8a-4c17-988f-08dacde34b31 X-MS-Exchange-CrossTenant-AuthSource: TY2PR0101MB3693.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2022 06:15:33.5109 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR01MB4208 Received-SPF: pass client-ip=2a01:111:f400:feab::821; envelope-from=rameshnedunchezian@HIDDEN; helo=APC01-SG2-obe.outbound.protection.outlook.com X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FROM=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 1.6 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: `string-to-number` returns ZERO if the input is not a =?UTF-8?Q?number.=C2=A0=C2=A0?= This return value is not very =?UTF-8?Q?helpful.=C2=A0?= The choice of a number ZERO as "Not A Number" doesn't help one to distinguish between the following two cases Content analysis details: (1.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 T_SPF_HELO_TEMPERROR SPF: test of HELO record failed (temperror) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (rameshnedunchezian[at]outlook.com) -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager 1.6 FORGED_MUA_MOZILLA Forged mail pretending to be from Mozilla `string-to-number` returns ZERO if the input is not a number. This return value is not very helpful. The choice of a number ZERO as "Not A Number" doesn't help one to distinguish between the following two cases (1) Input was a valid number, and it parses to number zero (2) Input was NOT a valid number, and it was forcibly reported as ZERO Consider amending `string-to-number` to throw an error (or return NIL) when the input is not parseable as a number, or providing an alternative API to validate numbers. I am trying to parse some fields in an org table, and see if the field value is a number or not; If there is already an alternative to what I am trying to accomplish, I would appreciate a recipe.
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Ramesh Nedunchezian <rameshnedunchezian@HIDDEN> Subject: bug#59531: Acknowledgement (29.0.50: An alternative to `string-to-number` which throws an error (or returns a NIL value) when input is non-parseable as number) Message-ID: <handler.59531.B.16692708586362.ack <at> debbugs.gnu.org> References: <TY2PR0101MB3693F7DD75CC1CCBA0EB9543DA0F9@HIDDEN> X-Gnu-PR-Message: ack 59531 X-Gnu-PR-Package: emacs Reply-To: 59531 <at> debbugs.gnu.org Date: Thu, 24 Nov 2022 06:21:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 59531 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 59531: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D59531 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#59531: 29.0.50: An alternative to `string-to-number` which throws an error (or returns a NIL value) when input is non-parseable as number Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Thu, 24 Nov 2022 08:00:02 +0000 Resent-Message-ID: <handler.59531.B59531.166927679616194 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 59531 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Ramesh Nedunchezian <rameshnedunchezian@HIDDEN> Cc: 59531 <at> debbugs.gnu.org Received: via spool by 59531-submit <at> debbugs.gnu.org id=B59531.166927679616194 (code B ref 59531); Thu, 24 Nov 2022 08:00:02 +0000 Received: (at 59531) by debbugs.gnu.org; 24 Nov 2022 07:59:56 +0000 Received: from localhost ([127.0.0.1]:57083 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1oy79H-0004D6-KO for submit <at> debbugs.gnu.org; Thu, 24 Nov 2022 02:59:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47212) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1oy79F-0004Cp-UP; Thu, 24 Nov 2022 02:59:54 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1oy79A-0000c4-IY; Thu, 24 Nov 2022 02:59:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=ZJrFrpljopL1Ei3wLoztnCiQhpWskiZdKlUwYVfPEl4=; b=VEdNDfHVuT2sDZyxLjAY C+pgxzSXvGQx4lzCgM4lfSx7v2EPPwniDBFbfMZtb+jZvZOfCZBrKvIEP9rT1oYo5zEm+fE9a9DKt CDSYvNEQpnW9WPKsIlm0QzbC1eX0deb3NXtVj6QvLhbqjgQfy6AMcsfw0EtuGSInkt/TI5gxpXDIL uIA7gP7rJUTF9TOmHxEwMEizDYcKbUtTCxWYRyJWorIevyF3ySIw3nm5azeyu+imgqNaIG3HI3Ouq rEyp5VPSyj/zEKgKxlf9fps2/7cFNpGDMlJ9lbnzuUlm8SiYZpEPBpxT0QG6yCqxTzCd+/lGbGdHw nKrH2740K55ixw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1oy79A-0007K5-0F; Thu, 24 Nov 2022 02:59:48 -0500 Date: Thu, 24 Nov 2022 10:00:06 +0200 Message-Id: <838rk0ye7t.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <TY2PR0101MB3693F7DD75CC1CCBA0EB9543DA0F9@HIDDEN> (message from Ramesh Nedunchezian on Thu, 24 Nov 2022 11:44:43 +0530) References: <TY2PR0101MB3693F7DD75CC1CCBA0EB9543DA0F9@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) tags 59531 wishlist thanks > Date: Thu, 24 Nov 2022 11:44:43 +0530 > From: Ramesh Nedunchezian <rameshnedunchezian@HIDDEN> > > `string-to-number` returns ZERO if the input is not a number. > > > This return value is not very helpful. The choice of a number ZERO as "Not A Number" doesn't help one to distinguish between the following two cases > > (1) Input was a valid number, and it parses to number zero > > (2) Input was NOT a valid number, and it was forcibly reported as ZERO > > Consider amending `string-to-number` to throw an error (or return NIL) when the input is not parseable as a number, or providing an alternative API to validate numbers. I am trying to parse some fields in an org table, and see if the field value is a number or not; Thanks. Changing the default behavior to signal an error is out of the question, since this is used in the Lisp reader and elsewhere, all over the place. It is very useful there. However, as an enhancement, we could have an additional optional argument to request that the function signal an error if the string cannot be parsed as a number. > If there is already an alternative to what I am trying to accomplish, I would appreciate a recipe. You could match the string to a regexp that validates its numerical appearance, before calling string-to-number.
Received: (at control) by debbugs.gnu.org; 24 Nov 2022 08:05:42 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 24 03:05:41 2022 Received: from localhost ([127.0.0.1]:57122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1oy7Er-0004Ov-OO for submit <at> debbugs.gnu.org; Thu, 24 Nov 2022 03:05:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46136) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1oy7Eq-0004Oh-05 for control <at> debbugs.gnu.org; Thu, 24 Nov 2022 03:05:40 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1oy7Ef-0004rU-6K for control <at> debbugs.gnu.org; Thu, 24 Nov 2022 03:05:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=crUHRavVGkgUnKkNlpjgCRr+o7kWuYlgYf6yiLHnMvQ=; b=TjWzEf1t1aO/ +q2ljgejbmjSnmKwwA8SCbK5UnwLsP2Xwg7XmBhJj6bNKg2iheUM/yOKwB/Cu0GuUOu8pX/nsm5hL UDrplu0644MFRt/Oi+y39VynxIGTYCVLRbWULu26RFXTnGlkVPTgVlN5CfJe14RTfHn5eKw4EW9FD VnaCQG0fc/VQcFyWdF68+3LolVNZGs52LYTcKoPqTeJQZye1F2m2zkqZOtfId9MQDnQbOFL9hnpHp v+MfojRCnNwghU0+j4ZyiGV10tADnqsNL98+yUgjS4DZHWjscHCVvAC9+To1azCdXU4+Us4n4bQ0L 3oJ/tdeMpTH5/wa0sGtAcw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1oy7Ed-0002Ox-Uz for control <at> debbugs.gnu.org; Thu, 24 Nov 2022 03:05:28 -0500 Date: Thu, 24 Nov 2022 10:05:48 +0200 Message-Id: <835yf4ydyb.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: control <at> debbugs.gnu.org (GNU bug tracker automated control server) In-Reply-To: <handler.s.C.166927679616200.transcript <at> debbugs.gnu.org> (control <at> debbugs.gnu.org) Subject: Re: Processed (with 1 errors): Re: bug#59531: 29.0.50: An alternative to `string-to-number` which throws an error (or returns a NIL value) when input is non-parseable as number References: <838rk0ye7t.fsf@HIDDEN> <handler.s.C.166927679616200.transcript <at> debbugs.gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) severity 59531 wishlist thanks
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.