emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#11887: closed (string->number edge cases)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#11887: closed (string->number edge cases)
Date: Thu, 07 Mar 2013 20:49:02 +0000

Your message dated Thu, 07 Mar 2013 15:47:17 -0500
with message-id <address@hidden>
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
address@hidden)


-- 
11887: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11887
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: string->number edge cases Date: Mon, 09 Jul 2012 13:29:16 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
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"

Attachment: string-conversion.scm
Description: Conversion tests courtesy of Peter Bex

Attachment: results.txt
Description: results


--- End Message ---
--- Begin Message --- Subject: Re: bug#11887: [PATCH] Improve standards conformance of string->number (was Re: bug#11887: string->number edge cases) Date: Thu, 07 Mar 2013 15:47:17 -0500 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
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


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]