GNU bug report logs -
#11887
string->number edge cases
Previous Next
Full log
View this message in rfc822 format
Hi Ian,
On Mon 09 Jul 2012 14:29, Ian Price <ianprice90 <at> googlemail.com> writes:
> PARSE ERROR ("+InF.0" +inf.0 "+inf.0" "+Inf.0") => #f
> PARSE ERROR ("-iNF.0" -inf.0 "-inf.0" "-Inf.0") => #f
> PARSE ERROR ("+NAN.0" +nan.0 "+nan.0" "+NaN.0") => #f
These are not errors. +NAN.0 is not even not a number :)
> PARSE ERROR ("+nan.1" #f) => +nan.0
> PARSE ERROR ("+nan.01" #f) => +nan.0
These are only supported because 2.0.0 was released with +nan.1 parsing
as +nan.0. It signals a deprecation warning with a note to this effect.
Guile from master should pass these particular tests.
> PARSE ERROR ("nan.0" #f) => +nan.0
> PARSE ERROR ("inf.0" #f) => +inf.0
> PARSE ERROR ("#e+nan.0" #f) => +nan.0
> PARSE ERROR ("#e+inf.0" #f) => +inf.0
> PARSE ERROR ("#e-inf.0" #f) => -inf.0
These are errors.
> 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)'.
This is also an error. We should plumb through some extra arg to
mem2ureal, I guess, to check for a zero denominator.
Andy
--
http://wingolog.org/
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.