GNU bug report logs -
#11887
string->number edge cases
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Thu, 07 Mar 2013 15:47:17 -0500
with message-id <87zjyf544q.fsf <at> tines.lan>
and subject line Re: bug#11887: [PATCH] Improve standards conformance of string->number (was Re: bug#11887: string->number edge cases)
has caused the debbugs.gnu.org bug report #11887,
regarding string->number edge cases
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
11887: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11887
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
Hi guilers,
I've mentioned these to Mark Weaver on IRC off-hand before, but I'm
posting this bug report to "formalise" it, and make sure we don't
forget.
Peter Bex, as one of the maintainers of the chicken "numbers" egg,
created a thorough test suite for string->number a while ago[0], and it
points out a number of possible and actual errors in the handling of
string->number.
I've attached a copy with the modifications for guile already applied,
and a copy of the full results, but the summary is as follows.
If the number contains a division by zero, we get a numerical overflow
error.
scheme@(guile−user)> (string->number "3/0")
ERROR: In procedure string−>number:
ERROR: Throw to key `numerical−overflow' with args `("make−ratio" "Numerical overflow" #f #f)'.
Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile−user) [1]> ,q
This contradicts the r6rs specification[1], which mandates a return
value of #f. IMO, this is the correct behaviour, since otherwise, we
have created a special case in the API for one type of invalid number.
(These tests cause the program to stop, and so are commented out in the
attached version.)
The rest of the errors are less serious, and show that we treat nans and
infinity someone inconsistently in guile. Specifically, we are strict on
case, and lenient on the numerical prefix.
0. http://bugs.call-cc.org/browser/release/4/numbers/trunk/tests/string-conversion.scm
1. http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html#node_idx_584
Peter,
Thanks for these
--
Ian Price
"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"
[string-conversion.scm (text/plain, attachment)]
[results.txt (text/plain, attachment)]
[Message part 6 (message/rfc822, inline)]
I wrote:
> Here's a patch to fix these problems. Comments and suggestions welcome.
I went ahead and pushed this to stable-2.0. I'm closing this bug.
Thanks,
Mark
This bug report was last modified 12 years and 160 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.