Happy Happy Joy Joy (was: On to Hydro)
Karp, Alan
alan_karp@hp.com
Mon, 21 Aug 2000 15:51:21 -0700
Still, a set should be able to hold NaNs and numbers. However, you have to
be really careful. A simple test like
if a != a && b != b then return true; // both a and b are NaNs
if a == b then return true; // handles case where
either a or b is NaN
else return false;
may not be what you want because a and b might be different NaNs. If you
need to distinguish NaNs with different contents, you'll need to tear the
numbers apart and do integer ops. Ugh!
_________________________
Alan Karp
Decision Technology Department
Hewlett-Packard Laboratories MS 1U-2
1501 Page Mill Road
Palo Alto, CA 94304
(650) 857-3967, fax (650) 857-6278
> -----Original Message-----
> From: Bill Frantz [mailto:frantz@communities.com]
> Sent: Monday, August 21, 2000 3:37 PM
> To: Tyler Close; Mark S. Miller
> Cc: E Language Discussions
> Subject: RE: Happy Happy Joy Joy (was: On to Hydro)
>
>
> At 06:08 PM 8/21/00 -0400, Tyler Close wrote:
> >Markm wrote:
> >> At 01:32 PM 8/21/00 , Tyler Close wrote:
> >> >? define m := RedBlackTree new(LesserDouble INSTANCE) asSet
> >> ># value: [ ]
> >> >
> >> >? define NaN := 0.0 / 0.0
> >> ># value: NaN
> >> >
> >> >? m := m with(NaN)
> >> ># value: [ NaN ]
> >>
> >> Since RedBlackTrees are supposed to only hold fully ordered
> >> sets, I propose
> >> that this operation should be an error. I hereby define ;)
> >> a singleton set
> >> of an irreflexive element to be a non fully ordered set.
> >
> >My RedBlackTree doesn't allow a second NaN to be inserted, but
> >wouldn't a Xanadu container allow it? In this case, the weird "I'm in
> >there, but you can't find me." behaviour would still be present. I
> >don't think you can define it away.
>
> I'm tempted to say that the only use for a container of
> garbage is to be
> removed by the trash collectors. :-)
>
> NaN is Not a number. It is an indication that your
> calculation produced
> garbage. You shouldn't expect it to behave like a number.
>