GNU bug report logs -
#16293
24.3.50; doc of `string-to-number'
Previous Next
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.
Full log
Message #14 received at 16293 <at> debbugs.gnu.org (full text, mbox):
> >> > 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.
This bug report was last modified 11 years and 141 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.