[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to detect division by zero?
From: |
Bernard Urban |
Subject: |
Re: how to detect division by zero? |
Date: |
13 Feb 2004 10:04:42 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
"Rouben Rostamian" <address@hidden> writes:
> Hello Guile users!
>
> How does one detect the result of a division by 0.0 in guile?
>
> In guile 1.6.4 we have:
>
> guile> (/ 1 0.)
> +#.#
>
> The usual tests are not informative:
>
> guile> (number? (/ 1 0.))
> #t
>
> guile> (positive? (/ 1 0.))
> #t
>
I read recently on this list that
there is some explicit test available for infinity or nan in 1.7.
I take the opportunity to pinpoint a bug in 1.6.4:
guile
guile> (version)
"1.6.4"
guile> (/ 0)
+#.#
guile> (/ 1 0)
standard input:3:1: In procedure / in expression (/ 1 0):
standard input:3:1: Numerical overflow
ABORT: (numerical-overflow)
Type "(backtrace)" to get more information or "(debug)" to enter the debugger.
guile>
In one case, the code in numbers.c for scm_divide computes the hardware
generated positive infinity, in the other an explicit call to
scm_num_overflow is made after testing the divisor value.
--
Bernard Urban
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: how to detect division by zero?,
Bernard Urban <=