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

Re: arithmetic issues




On Sun, 23 Oct 2005, [ISO-8859-1] Jens Axel Søgaard wrote:

>Say I want to write my own mathematical function and need to return NaN?
>E.g.
>
>   (if <check-arguments>
>       <calculate-result>
>       #<not-a-number>

Okay, how about a library function:

(define NaN (lambda()
"return a NaN for use in other functions,
 because there is no read/write syntax for NaN."
(/ 0.0 0.0)))

then you can write:

   (if <check-arguments>
       <calculate-results>
       (NaN))

So your code is clear and readable, and yet you
don't have a read/write syntax that makes it unclear
whether read is failing or just reading an error.

				Bear