From: Richard F. <fa...@be...> - 2014-09-03 17:14:21
|
A solution to this problem of inf-inf (and a number of others) is to tag each inf uniquely. So then inf-inf is zero if those infs are identically tagged. Thus k : limit(1/x,x,0); k-k returns 0 On 9/3/2014 9:08 AM, Raymond Toy wrote: >>>>>> "Robert" == Robert Dodier <rob...@gm...> writes: > Robert> On 2014-09-01, David Billinghurst <dbm...@gm...> wrote: > >> I:87^611$ > >> M:91^211$ > >> sign(sqrt(I)-M); > > Robert> Thanks for the example. Here's a proposed fix. This causes $FLOAT to > Robert> always fail (even for Lisps which otherwise allow float infinity) > Robert> and therefore SIGN1 takes a different route and sign returns 'pos. > > Robert> The patch assumes that (float inf) minus (float inf) != 0. > Robert> I'm pretty sure that's required by IEEE 754 (in fact I think the > Robert> result is supposed to be NaN) but I can't quote chapter & verse > Robert> at the moment. > > Yes, inf - inf is NaN, in IEEE754 arithmetic. As is inf*0. I would > add a comment to the code saying so for the next user who isn't so > familiar with IEEE754. > > On the other hand, didn't you also write some kind of float-infinity-p > function already? If not, we should probably add a float-infinity-p > and float-nan-p functions just for cases like this. > > -- > Ray > > > ------------------------------------------------------------------------------ > Slashdot TV. > Video for Nerds. Stuff that matters. > http://tv.slashdot.org/ > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss |