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

Full log


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




This bug report was last modified 307 days ago.

Previous Next


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