GNU bug report logs - #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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Ramesh Nedunchezian <rameshnedunchezian@HIDDEN>; dated Thu, 24 Nov 2022 06:21:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Eli Zaretskii <eliz@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 59531 <at> debbugs.gnu.org:


Received: (at 59531) by debbugs.gnu.org; 24 Nov 2022 07:59:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 24 02:59:55 2022
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>
To: Ramesh Nedunchezian <rameshnedunchezian@HIDDEN>
In-Reply-To: <TY2PR0101MB3693F7DD75CC1CCBA0EB9543DA0F9@HIDDEN>
 (message from Ramesh Nedunchezian on Thu, 24 Nov 2022 11:44:43 +0530)
Subject: 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: <TY2PR0101MB3693F7DD75CC1CCBA0EB9543DA0F9@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 59531
Cc: 59531 <at> debbugs.gnu.org
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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#59531; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 24 Nov 2022 06:20:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 24 01:20:58 2022
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
To: bug-gnu-emacs@HIDDEN
From: Ramesh Nedunchezian <rameshnedunchezian@HIDDEN>
Subject: 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
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;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ZyNjlHS25UK3l0NDJWNVhwenRHWkM5cUdtUXV0?=
 =?utf-8?B?VTkvWTY3dXgxd0hpbFk1QWhoR0ZNejJCZTc0ODdpRVF6TFVHMGw2M3lhNVBM?=
 =?utf-8?B?b3ZJd3l2cDJKK1VMcGNmNjVUL0ZhWDkxU2FTRWxJdTlJZjBiN1I1ZHFnTkI4?=
 =?utf-8?B?Sk5obTc5aDBtK0NCOUxQSGRleWJxbnJPbmd4bkdIVkpyWTB5Q1FYMVJiYmJa?=
 =?utf-8?B?WkxodXZ2TUQvbnhsY2JDVVE0djZJWVc1REp6RzNGZWlBUEpidWtGdEJ4Z3dj?=
 =?utf-8?B?Q0FucVlpN3RDTVBlMVJtSkxQb1labGpJdnRsZjd4cjhyQlFwY0xYRXl4dnpt?=
 =?utf-8?B?VzZFZVg1dUMzdzFYNHFQMkxJNXc2bGJmN2o5cTBjRjg3ZEd3RUVpNGcxejRK?=
 =?utf-8?B?SmRDVUQ4dk1OdFJLZVA0dEhiRGgvME9aaUFtTHk0SDEzcUhqNmcrWDg4V2pm?=
 =?utf-8?B?ZlZlbDU5RWJUR3RpRE9ISWNIT3h4VkZ0eHBxd3BEUUNoaHVGODhTOUhzSHI1?=
 =?utf-8?B?bjhmRTRkZUE0RWZqRmVjTGxpZ042cXNOMVdTa1VyRkFYOFhkQklxOEtINlIv?=
 =?utf-8?Q?ZdquyxXVh4Fvl5KYbI=3D?=
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-Debbugs-Envelope-To: submit
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 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
    
 
 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.







Acknowledgement sent to Ramesh Nedunchezian <rameshnedunchezian@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#59531; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 24 Nov 2022 08:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.