* bug#16293: 24.3.50; doc of `string-to-number'
@ 2013-12-29 22:20 Drew Adams
2013-12-29 22:47 ` Jay Belanger
2014-01-05 1:25 ` Paul Eggert
0 siblings, 2 replies; 5+ messages in thread
From: Drew Adams @ 2013-12-29 22:20 UTC (permalink / raw)
To: 16293
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@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'
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#16293: 24.3.50; doc of `string-to-number'
2013-12-29 22:20 bug#16293: 24.3.50; doc of `string-to-number' Drew Adams
@ 2013-12-29 22:47 ` Jay Belanger
2013-12-29 23:07 ` Drew Adams
2014-01-05 1:25 ` Paul Eggert
1 sibling, 1 reply; 5+ messages in thread
From: Jay Belanger @ 2013-12-29 22:47 UTC (permalink / raw)
To: 16293
> 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?
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#16293: 24.3.50; doc of `string-to-number'
2013-12-29 22:47 ` Jay Belanger
@ 2013-12-29 23:07 ` Drew Adams
[not found] ` <87sitb9q6n.fsf@gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2013-12-29 23:07 UTC (permalink / raw)
To: jay.p.belanger, 16293
> > 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.)
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#16293: 24.3.50; doc of `string-to-number'
[not found] ` <87sitb9q6n.fsf@gmail.com>
@ 2013-12-30 0:03 ` Drew Adams
0 siblings, 0 replies; 5+ messages in thread
From: Drew Adams @ 2013-12-30 0:03 UTC (permalink / raw)
To: jay.p.belanger; +Cc: 16293
> >> > 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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#16293: 24.3.50; doc of `string-to-number'
2013-12-29 22:20 bug#16293: 24.3.50; doc of `string-to-number' Drew Adams
2013-12-29 22:47 ` Jay Belanger
@ 2014-01-05 1:25 ` Paul Eggert
1 sibling, 0 replies; 5+ messages in thread
From: Paul Eggert @ 2014-01-05 1:25 UTC (permalink / raw)
To: 16293-done
Thanks for the bug report; fixed in trunk bzr 115868.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-01-05 1:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-29 22:20 bug#16293: 24.3.50; doc of `string-to-number' Drew Adams
2013-12-29 22:47 ` Jay Belanger
2013-12-29 23:07 ` Drew Adams
[not found] ` <87sitb9q6n.fsf@gmail.com>
2013-12-30 0:03 ` Drew Adams
2014-01-05 1:25 ` Paul Eggert
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).