[r6rs-discuss] [Formal] Unclear how equality predicates behave on NaN

From: Marcin 'Qrczak' Kowalczyk <qrczak>
Date: Mon Sep 25 06:08:22 2006

Paul Schlie <schlie_at_comcast.net> writes:

> (/ +0.0) => +Inf
> (/ 0) => NaN
> (/ -0.0) => -Inf

I believe (/ 0) should be an error.

The rationale for producing NaN in general, rather than signalling
an error immediately, is that numeric inaccuracies might cause an
argument of an operation to fall outside the domain. The algorithm
which produces it might be correct from the mathematical point of
view, there is no bug in the code to fix, only the inaccuracy is so
large that the result cannot be computed. If the NaN is one element of
a large matrix, then the matrix as a whole exists, and other elements
may still be useful. OTOH division by exact 0 means that the result is
known to not exist.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak_at_knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/
Received on Mon Sep 25 2006 - 06:08:10 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC