bug-guile
[Top][All Lists]
Advanced

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

bug#11887: string->number edge cases


From: Andy Wingo
Subject: bug#11887: string->number edge cases
Date: Tue, 05 Mar 2013 15:49:13 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

Hi Ian,

On Mon 09 Jul 2012 14:29, Ian Price <address@hidden> 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/





reply via email to

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