GNU bug report logs - #11887
string->number edge cases

Previous Next

Package: guile;

Reported by: Ian Price <ianprice90 <at> googlemail.com>

Date: Mon, 9 Jul 2012 12:36:01 UTC

Severity: normal

Done: Mark H Weaver <mhw <at> netris.org>

Bug is archived. No further changes may be made.

Full log


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

From: Andy Wingo <wingo <at> pobox.com>
To: Ian Price <ianprice90 <at> googlemail.com>
Cc: Peter.Bex <at> xs4all.nl, 11887 <at> debbugs.gnu.org
Subject: Re: bug#11887: string->number edge cases
Date: Tue, 05 Mar 2013 15:49:13 +0100
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.