GNU bug report logs - #18932
string->number errors on e.g. "1e400xyz"

Previous Next

Package: guile;

Reported by: taylanbayirli <at> gmail.com ("Taylan Ulrich Bayırlı/Kammer")

Date: Mon, 3 Nov 2014 09:22:02 UTC

Severity: normal

To reply to this bug, email your comments to 18932 AT debbugs.gnu.org.

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-guile <at> gnu.org:
bug#18932; Package guile. (Mon, 03 Nov 2014 09:22:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to taylanbayirli <at> gmail.com ("Taylan Ulrich Bayırlı/Kammer"):
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Mon, 03 Nov 2014 09:22:02 GMT) Full text and rfc822 format available.

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

From: taylanbayirli <at> gmail.com ("Taylan Ulrich Bayırlı/Kammer")
To: bug-guile <at> gnu.org
Subject: string->number errors on e.g. "1e400xyz"
Date: Mon, 03 Nov 2014 10:20:58 +0100
When string->number is given a number in scientific notation with a
very high exponent, it errors with "value out of range."

I don't know if that is acceptable, but what seems unacceptable is
that it errors even if the string contains further characters and is
thus not a valid number; R5RS says that #f should be returned when the
string does not contain a syntactically valid number, and R7RS adds
explicitly that string->number never signals an error due to the
contents of the given string.

Apparently MIT/GNU Scheme has the same bug, as reported by 'ecraven'
on #scheme.  From other systems I tested, Racket, Gauche, Gambit, and
Chibi return +inf.0 for numbers with a too high exponent; I'm told
Chicken also does so when the "numbers egg" is loaded.

Taylan




Information forwarded to bug-guile <at> gnu.org:
bug#18932; Package guile. (Wed, 21 Jan 2015 18:02:03 GMT) Full text and rfc822 format available.

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

From: "guile <at> discard.email" <guile <at> discard.email>
To: 18932 <at> debbugs.gnu.org
Subject: Re: #18932 string->number errors on e.g. "1e400xyz"
Date: Wed, 21 Jan 2015 12:36:50 +0100
[Message part 1 (text/plain, inline)]
Note that guile 2.0.11 also gives strange results for large negative exponents:
scheme@(guile-user)> (string->number "1e-400")ERROR: In procedure string->number:ERROR: In procedure string->number: Value out of range: -400
 
For comparison, in Scheme 48 1.9
(string->number "1e-400") => 0.0
(string->number "1e400") => +inf.0
(string->number "1e400xyz") => #f
[Message part 2 (text/html, inline)]

Information forwarded to bug-guile <at> gnu.org:
bug#18932; Package guile. (Mon, 08 Aug 2016 20:37:02 GMT) Full text and rfc822 format available.

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

From: Andy Wingo <wingo <at> pobox.com>
To: 18932 <at> debbugs.gnu.org
Subject: [Anand Mohanadoss] symbol printing problem
Date: Mon, 08 Aug 2016 22:35:55 +0200
[Message part 1 (message/rfc822, inline)]
From: Anand Mohanadoss <anand108 <at> gmail.com>
To: guile-user <at> gnu.org
Subject: symbol printing problem
Date: Mon, 8 Aug 2016 18:04:45 +0530
Hi,

We observed the following with guile 2.0.11 -

scheme@(guile-user)> (define sym '912828S7912810RS)
While reading expression:
ERROR: In procedure string->number: Value out of range: 7912810

Is this expected?  Do we need to enable any read-options?  If this is
expected, it appears that if we are creating symbols from random data, we
need to do a symbol->string before printing it.  Is this the recommendation
or should we do something else?

Thank you!
Anand




Information forwarded to bug-guile <at> gnu.org:
bug#18932; Package guile. (Thu, 15 Sep 2016 03:28:02 GMT) Full text and rfc822 format available.

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

From: Jonathan Theodore Mayer <jtmayer <at> uci.edu>
To: 18932 <at> debbugs.gnu.org
Date: Wed, 14 Sep 2016 17:56:55 -0700
[Message part 1 (text/plain, inline)]
The lowest and highest exponent that do not result in an error for
string->number are -324 and 308, respectively. I am running Guile 2.0.9.
[Message part 2 (text/html, inline)]

Information forwarded to bug-guile <at> gnu.org:
bug#18932; Package guile. (Fri, 09 Aug 2024 23:45:02 GMT) Full text and rfc822 format available.

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

From: nathan <nathan_mail <at> nborghese.com>
To: 18932 <at> debbugs.gnu.org
Subject: string->number errors on e.g. "1e400xyz"
Date: Fri, 9 Aug 2024 23:43:56 +0000
still happens on the latest guile.
trying to (write) a symbol that starts with large scientific notation also causes this problem.
(write (string->symbol "1e400xyz"))




This bug report was last modified 306 days ago.

Previous Next


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