[PATCH] for doozy

From: Squeak <squeak_at_xirr.com>
Date: Sun, 10 Oct 1999 19:38:37 -0400 (EDT)

It appears to be a "quirk" /bug in gmp... this problem may be more
pervasive ... basically here's a rule of thumb: never ever ever ever
compare floating points. On a 68020 under CodeWarrior (5ish) in optimizing
mode "if(0.0==0.0)" is FALSE.

Always use at the very least a difference "if (0.0-0.0<EPSILON)" or better
yet use a relative difference, checking for division by zero.

So here is the fix, George may want to replace all calls of mpf_cmp()==0
with my line. It should comapre all but the last bit (or so) and use that
as an equality sign. This works here ONLY. If George (or someone) wants
one that works all the time, let me know but I have the feeling that the
following might NOT work.

inline my_mpf_eq(mpf_t *a,mpf_t*b) {
        int i;
        return mpf_eq(a,b,i);

--- mpwrap.c.old Sun Oct 10 18:57:56 1999
+++ mpwrap.c Sun Oct 10 19:00:02 1999
@@ -2322,10 +2322,14 @@
+ if(mpf_eq(fr2,fr,fr->_mp_size*8-1))
+ break;
Received on Sun Oct 10 1999 - 16:09:25 CDT

This archive was generated by hypermail 2.2.0 : Sun Apr 17 2011 - 21:00:02 CDT