--- numbers.c.~1.224.~ 2004-02-22 08:02:53.000000000 +1000 +++ numbers.c 2004-03-22 18:46:23.000000000 +1000 @@ -3442,13 +3442,10 @@ } else if (SCM_REALP (y)) { + /* if y==NaN then xx>yy is false, so we return the NaN y */ + double xx = scm_i_big2dbl (x); double yy = SCM_REAL_VALUE (y); - int cmp; - if (xisnan (yy)) - return y; - cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (x), yy); - scm_remember_upto_here_1 (x); - return (cmp > 0) ? x : y; + return (xx > yy ? scm_make_real (xx) : y); } else if (SCM_FRACTIONP (y)) { @@ -3471,13 +3468,10 @@ } else if (SCM_BIGP (y)) { + /* if x==NaN then yy>xx is false, so we return the NaN x */ double xx = SCM_REAL_VALUE (x); - int cmp; - if (xisnan (xx)) - return x; - cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (y), xx); - scm_remember_upto_here_1 (y); - return (cmp < 0) ? x : y; + double yy = scm_i_big2dbl (y); + return (yy > xx ? scm_make_real (yy) : x); } else if (SCM_REALP (y)) { @@ -3591,13 +3585,10 @@ } else if (SCM_REALP (y)) { + /* if y==NaN then xx 0) ? y : x; + return (xx < yy ? scm_make_real (xx) : y); } else if (SCM_FRACTIONP (y)) { @@ -3620,13 +3611,10 @@ } else if (SCM_BIGP (y)) { - double xx = SCM_REAL_VALUE (x); - int cmp; - if (xisnan (xx)) - return x; - cmp = xmpz_cmp_d (SCM_I_BIG_MPZ (y), xx); - scm_remember_upto_here_1 (y); - return (cmp < 0) ? y : x; + /* if x==NaN then yy