* bug#18932: string->number errors on e.g. "1e400xyz"
@ 2014-11-03 9:20 "Taylan Ulrich Bayırlı/Kammer"
2015-01-21 11:36 ` bug#18932: #18932 " guile
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: "Taylan Ulrich Bayırlı/Kammer" @ 2014-11-03 9:20 UTC (permalink / raw)
To: 18932
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#18932: #18932 string->number errors on e.g. "1e400xyz"
2014-11-03 9:20 bug#18932: string->number errors on e.g. "1e400xyz" "Taylan Ulrich Bayırlı/Kammer"
@ 2015-01-21 11:36 ` guile
2016-08-08 20:35 ` bug#18932: [Anand Mohanadoss] symbol printing problem Andy Wingo
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: guile @ 2015-01-21 11:36 UTC (permalink / raw)
To: 18932
[-- Attachment #1: Type: text/plain, Size: 367 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 464 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#18932: [Anand Mohanadoss] symbol printing problem
2014-11-03 9:20 bug#18932: string->number errors on e.g. "1e400xyz" "Taylan Ulrich Bayırlı/Kammer"
2015-01-21 11:36 ` bug#18932: #18932 " guile
@ 2016-08-08 20:35 ` Andy Wingo
2016-09-15 0:56 ` bug#18932: Jonathan Theodore Mayer
2024-08-09 23:43 ` bug#18932: string->number errors on e.g. "1e400xyz" nathan via Bug reports for GUILE, GNU's Ubiquitous Extension Language
3 siblings, 0 replies; 5+ messages in thread
From: Andy Wingo @ 2016-08-08 20:35 UTC (permalink / raw)
To: 18932
[-- Attachment #0: Type: message/rfc822, Size: 7382 bytes --]
From: Anand Mohanadoss <anand108@gmail.com>
To: guile-user@gnu.org
Subject: symbol printing problem
Date: Mon, 8 Aug 2016 18:04:45 +0530
Message-ID: <CAFNjtaD8DESceh0ZMEBWb=9PqUhNG_onk8ycb8EL-6eDaQJaNA@mail.gmail.com>
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#18932:
2014-11-03 9:20 bug#18932: string->number errors on e.g. "1e400xyz" "Taylan Ulrich Bayırlı/Kammer"
2015-01-21 11:36 ` bug#18932: #18932 " guile
2016-08-08 20:35 ` bug#18932: [Anand Mohanadoss] symbol printing problem Andy Wingo
@ 2016-09-15 0:56 ` Jonathan Theodore Mayer
2024-08-09 23:43 ` bug#18932: string->number errors on e.g. "1e400xyz" nathan via Bug reports for GUILE, GNU's Ubiquitous Extension Language
3 siblings, 0 replies; 5+ messages in thread
From: Jonathan Theodore Mayer @ 2016-09-15 0:56 UTC (permalink / raw)
To: 18932
[-- Attachment #1: Type: text/plain, Size: 140 bytes --]
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.
[-- Attachment #2: Type: text/html, Size: 164 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#18932: string->number errors on e.g. "1e400xyz"
2014-11-03 9:20 bug#18932: string->number errors on e.g. "1e400xyz" "Taylan Ulrich Bayırlı/Kammer"
` (2 preceding siblings ...)
2016-09-15 0:56 ` bug#18932: Jonathan Theodore Mayer
@ 2024-08-09 23:43 ` nathan via Bug reports for GUILE, GNU's Ubiquitous Extension Language
3 siblings, 0 replies; 5+ messages in thread
From: nathan via Bug reports for GUILE, GNU's Ubiquitous Extension Language @ 2024-08-09 23:43 UTC (permalink / raw)
To: 18932
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"))
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-08-09 23:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-03 9:20 bug#18932: string->number errors on e.g. "1e400xyz" "Taylan Ulrich Bayırlı/Kammer"
2015-01-21 11:36 ` bug#18932: #18932 " guile
2016-08-08 20:35 ` bug#18932: [Anand Mohanadoss] symbol printing problem Andy Wingo
2016-09-15 0:56 ` bug#18932: Jonathan Theodore Mayer
2024-08-09 23:43 ` bug#18932: string->number errors on e.g. "1e400xyz" nathan via Bug reports for GUILE, GNU's Ubiquitous Extension Language
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).