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

Re: [Scheme-reports] Formal Comment: R7RS 'eqv?' cannot be used for reliable memoization

Ray Dillinger <bear@x> writes:
> I see +0.0 and -0.0 as branch cut selectors.

Basically, yes.  The usual way to think about them is (f +0.0) is the
limit of (f x) as x approaches zero from above, and (f -0.0) is the
limit of (f x) as x approaches zero from below.

> Branch cut selectors are strictly unnecessary in a
> language that has the ability to return multiple values
> from a function; the alternative is to simply return
> both (or all) answers at non-continuous points.

That would not be sufficient, because then the program would be left to
decide which of those multiple values is the right one.

For example, suppose 'z' is (make-rectangular -1 (- epsilon)) where
'epsilon' is approaching zero in some loop.  Signed zeroes ensure that
(log z) approaches -pi, and does not abruptly change to +pi when the
imaginary part of 'z' underflows.

If (log z) abruptly starts returning two values, how is the program
supposed to cope with that?  How does it decide which one to choose?


Scheme-reports mailing list