GNU bug report logs - #16293
24.3.50; doc of `string-to-number'

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Sun, 29 Dec 2013 22:21:01 UTC

Severity: minor

Found in version 24.3.50

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16293 in the body.
You can then email your comments to 16293 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#16293; Package emacs. (Sun, 29 Dec 2013 22:21:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Drew Adams <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 29 Dec 2013 22:21:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; doc of `string-to-number'
Date: Sun, 29 Dec 2013 14:20:14 -0800 (PST)
Say what happens if STRING cannot successfully be parsed as a number:
the function raises an error.

The doc (e.g. manual) describes the parsing in a fair amount of detail,
and it describes how the result can end up a floating-point number if
the integer value would be too large.  But it says nothing about what
happens if no number can be identified for the string.



In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
 of 2013-12-27 on ODIEONE
Bzr revision: 115778 rgm <at> gnu.org-20131228000456-1797o8z6veuyozs0
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/binary --enable-checking=yes,glyphs
 'CFLAGS=-O0 -g3' LDFLAGS=-Lc:/Devel/emacs/lib
 CPPFLAGS=-Ic:/Devel/emacs/include'




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16293; Package emacs. (Sun, 29 Dec 2013 22:49:02 GMT) Full text and rfc822 format available.

Message #8 received at 16293 <at> debbugs.gnu.org (full text, mbox):

From: Jay Belanger <jay.p.belanger <at> gmail.com>
To: 16293 <at> debbugs.gnu.org
Cc: jay.p.belanger <at> gmail.com
Subject: Re: bug#16293: 24.3.50; doc of `string-to-number'
Date: Sun, 29 Dec 2013 16:47:36 -0600
> Say what happens if STRING cannot successfully be parsed as a number:
> the function raises an error.

When would it give an error, rather than 0?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16293; Package emacs. (Sun, 29 Dec 2013 23:08:01 GMT) Full text and rfc822 format available.

Message #11 received at 16293 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: jay.p.belanger <at> gmail.com, 16293 <at> debbugs.gnu.org
Subject: RE: bug#16293: 24.3.50; doc of `string-to-number'
Date: Sun, 29 Dec 2013 15:07:49 -0800 (PST)
> > Say what happens if STRING cannot successfully be parsed as a number:
> > the function raises an error.
> 
> When would it give an error, rather than 0?

If it never raises an error, then say explicitly that for any
string that cannot successfully be parsed as a number it returns 0.

(Cf. bug #16294, which was giving me the impression at first that
`string-to-number' was raising an error.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16293; Package emacs. (Mon, 30 Dec 2013 00:04:01 GMT) Full text and rfc822 format available.

Message #14 received at 16293 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: jay.p.belanger <at> gmail.com
Cc: 16293 <at> debbugs.gnu.org
Subject: RE: bug#16293: 24.3.50; doc of `string-to-number'
Date: Sun, 29 Dec 2013 16:03:29 -0800 (PST)
> >> > Say what happens if STRING cannot successfully be parsed as a number:
> >> > the function raises an error.
> >>
> >> When would it give an error, rather than 0?
> >
> > If it never raises an error, then say explicitly that for any
> > string that cannot successfully be parsed as a number it returns 0.
> 
> It does say:
>      If the first character after the ignored whitespace is neither a
>      digit in the given base, nor a plus or minus sign, nor the leading
>      dot of a floating point number, this function returns 0.
>
> Should this be reworded, or perhaps moved to earlier in the
> documentation?

It should be corrected to be more complete.  It's not just about the
first character.  Any string of characters that cannot be successfully
parsed as a number results in a return value of zero (apparently - I
have not checked the code).  "+@", for instance.
 




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Sun, 05 Jan 2014 01:26:01 GMT) Full text and rfc822 format available.

Notification sent to Drew Adams <drew.adams <at> oracle.com>:
bug acknowledged by developer. (Sun, 05 Jan 2014 01:26:02 GMT) Full text and rfc822 format available.

Message #19 received at 16293-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 16293-done <at> debbugs.gnu.org
Subject: Re:  24.3.50; doc of `string-to-number'
Date: Sat, 04 Jan 2014 17:25:24 -0800
Thanks for the bug report; fixed in trunk bzr 115868.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 02 Feb 2014 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 98 days ago.

Previous Next


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