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

Re: arithmetic issues



Aubrey Jaffer wrote:
 | From: Thomas Bushnell BSG <tb@xxxxxxxxxx>
 | Date: Sun, 23 Oct 2005 12:39:43 -0700
| | Aubrey Jaffer <agj@xxxxxxxxxxxx> writes: | | > When different NaNs are returned depending on the circumstances
 | > creating them, I would like my implementation to display them
 | > like this:
 | >
 | >   #<not-a-number expt>
| | Sure, that seems fine. We could mandate that as the readable written
 | representation!

It should *not* be a readable representation.  That serves only to
mask mathematical errors in saved datasets.  As Bakul Shah wrote:
"... IEEE754 says NaN is the result of an *invalid* operation, when an
operation's operands lie outside its domain."


Say I want to write my own mathematical function and need to return NaN?
E.g.

  (if <check-arguments>
      <calculate-result>
      #<not-a-number>

is, to me, more readable than

  (if <check-arguments>
      <calculate-result>
      (/ 0.0 0.0))

--
Jens Axel Søgaard