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

Re: arithmetic issues

This page is part of the web mail archives of SRFI 77 from before July 7th, 2015. The new archives for SRFI 77 contain all messages, not just those from before July 7th, 2015.




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