[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: division by 0
From: |
Marius Vollmer |
Subject: |
Re: division by 0 |
Date: |
Sun, 21 Mar 2004 01:34:27 +0100 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) |
Bernard Urban <address@hidden> writes:
> Debian woody on i386.
>
> $ guile
> guile> (version)
> "1.6.4"
> guile> (/ 0)
> +#.#
> guile> (/ 1.0 0)
> +#.#
> guile> (/ 1 0.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>
>
> Problem happens in numbers.c, function scm_divide(), where the test
> #line 3274 should not be made.
The 1.7 series should be handling this more correctly. From NEWS:
** There is support for Infinity and NaNs.
Following PLT Scheme, Guile can now work with infinite numbers, and
'not-a-numbers'.
There is new syntax for numbers: "+inf.0" (infinity), "-inf.0"
(negative infinity), "+nan.0" (not-a-number), and "-nan.0" (same as
"+nan.0"). These numbers are inexact and have no exact counterpart.
Dividing by an inexact zero returns +inf.0 or -inf.0, depending on the
sign of the dividend. The infinities are integers, and they answer #t
for both 'even?' and 'odd?'. The +nan.0 value is not an integer and is
not '=' to itself, but '+nan.0' is 'eqv?' to itself.
For example
(/ 1 0.0)
=> +inf.0
(/ 0 0.0)
=> +nan.0
(/ 0)
ERROR: Numerical overflow
Two new predicates 'inf?' and 'nan?' can be used to test for the
special values.
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
- division by 0, Bernard Urban, 2004/03/05
- Re: division by 0,
Marius Vollmer <=