/[guile]/guile/guile-core/libguile/numbers.c
ViewVC logotype

Diff of /guile/guile-core/libguile/numbers.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.184 by kryde, Mon May 5 23:01:30 2003 UTC revision 1.185 by kryde, Fri May 9 23:14:35 2003 UTC
# Line 2520  scm_num_eq_p (SCM x, SCM y) Line 2520  scm_num_eq_p (SCM x, SCM y)
2520        scm_remember_upto_here_2 (x, y);        scm_remember_upto_here_2 (x, y);
2521        return SCM_BOOL (0 == cmp);        return SCM_BOOL (0 == cmp);
2522      } else if (SCM_REALP (y)) {      } else if (SCM_REALP (y)) {
2523        int cmp = mpz_cmp_d (SCM_I_BIG_MPZ (x), SCM_REAL_VALUE (y));        int cmp;
2524          if (xisnan (SCM_REAL_VALUE (y))) return SCM_BOOL_F;
2525          cmp = mpz_cmp_d (SCM_I_BIG_MPZ (x), SCM_REAL_VALUE (y));
2526        scm_remember_upto_here_1 (x);        scm_remember_upto_here_1 (x);
2527        return SCM_BOOL (0 == cmp);        return SCM_BOOL (0 == cmp);
2528      } else if (SCM_COMPLEXP (y)) {      } else if (SCM_COMPLEXP (y)) {
2529        int cmp;        int cmp;
2530        if (0.0 != SCM_COMPLEX_IMAG (y)) return SCM_BOOL_F;        if (0.0 != SCM_COMPLEX_IMAG (y)) return SCM_BOOL_F;
2531          if (xisnan (SCM_COMPLEX_REAL (y))) return SCM_BOOL_F;
2532        cmp = mpz_cmp_d (SCM_I_BIG_MPZ (x), SCM_COMPLEX_REAL (y));        cmp = mpz_cmp_d (SCM_I_BIG_MPZ (x), SCM_COMPLEX_REAL (y));
2533        scm_remember_upto_here_1 (x);        scm_remember_upto_here_1 (x);
2534        return SCM_BOOL (0 == cmp);        return SCM_BOOL (0 == cmp);
# Line 2536  scm_num_eq_p (SCM x, SCM y) Line 2539  scm_num_eq_p (SCM x, SCM y)
2539      if (SCM_INUMP (y)) {      if (SCM_INUMP (y)) {
2540        return SCM_BOOL (SCM_REAL_VALUE (x) == (double) SCM_INUM (y));        return SCM_BOOL (SCM_REAL_VALUE (x) == (double) SCM_INUM (y));
2541      } else if (SCM_BIGP (y)) {      } else if (SCM_BIGP (y)) {
2542        int cmp = mpz_cmp_d (SCM_I_BIG_MPZ (y), SCM_REAL_VALUE (x));        int cmp;
2543          if (xisnan (SCM_REAL_VALUE (x))) return SCM_BOOL_F;
2544          cmp = mpz_cmp_d (SCM_I_BIG_MPZ (y), SCM_REAL_VALUE (x));
2545        scm_remember_upto_here_1 (y);        scm_remember_upto_here_1 (y);
2546        return SCM_BOOL (0 == cmp);        return SCM_BOOL (0 == cmp);
2547      } else if (SCM_REALP (y)) {      } else if (SCM_REALP (y)) {
# Line 2554  scm_num_eq_p (SCM x, SCM y) Line 2559  scm_num_eq_p (SCM x, SCM y)
2559      } else if (SCM_BIGP (y)) {      } else if (SCM_BIGP (y)) {
2560        int cmp;        int cmp;
2561        if (0.0 != SCM_COMPLEX_IMAG (x)) return SCM_BOOL_F;        if (0.0 != SCM_COMPLEX_IMAG (x)) return SCM_BOOL_F;
2562          if (xisnan (SCM_COMPLEX_REAL (x))) return SCM_BOOL_F;
2563        cmp = mpz_cmp_d (SCM_I_BIG_MPZ (y), SCM_COMPLEX_REAL (x));        cmp = mpz_cmp_d (SCM_I_BIG_MPZ (y), SCM_COMPLEX_REAL (x));
2564        scm_remember_upto_here_1 (y);        scm_remember_upto_here_1 (y);
2565        return SCM_BOOL (0 == cmp);        return SCM_BOOL (0 == cmp);
# Line 2603  scm_less_p (SCM x, SCM y) Line 2609  scm_less_p (SCM x, SCM y)
2609        scm_remember_upto_here_2 (x, y);        scm_remember_upto_here_2 (x, y);
2610        return SCM_BOOL (cmp < 0);        return SCM_BOOL (cmp < 0);
2611      } else if (SCM_REALP (y)) {      } else if (SCM_REALP (y)) {
2612        int cmp = mpz_cmp_d (SCM_I_BIG_MPZ (x), SCM_REAL_VALUE (y));        int cmp;
2613          if (xisnan (SCM_REAL_VALUE (y))) return SCM_BOOL_F;
2614          cmp = mpz_cmp_d (SCM_I_BIG_MPZ (x), SCM_REAL_VALUE (y));
2615        scm_remember_upto_here_1 (x);        scm_remember_upto_here_1 (x);
2616        return SCM_BOOL (cmp < 0);        return SCM_BOOL (cmp < 0);
2617      } else {      } else {
# Line 2613  scm_less_p (SCM x, SCM y) Line 2621  scm_less_p (SCM x, SCM y)
2621      if (SCM_INUMP (y)) {      if (SCM_INUMP (y)) {
2622        return SCM_BOOL (SCM_REAL_VALUE (x) < (double) SCM_INUM (y));        return SCM_BOOL (SCM_REAL_VALUE (x) < (double) SCM_INUM (y));
2623      } else if (SCM_BIGP (y)) {      } else if (SCM_BIGP (y)) {
2624        int cmp = mpz_cmp_d (SCM_I_BIG_MPZ (y), SCM_REAL_VALUE (x));        int cmp;
2625          if (xisnan (SCM_REAL_VALUE (x))) return SCM_BOOL_F;
2626          cmp = mpz_cmp_d (SCM_I_BIG_MPZ (y), SCM_REAL_VALUE (x));
2627        scm_remember_upto_here_1 (y);        scm_remember_upto_here_1 (y);
2628        return SCM_BOOL (cmp > 0);        return SCM_BOOL (cmp > 0);
2629      } else if (SCM_REALP (y)) {      } else if (SCM_REALP (y)) {

Legend:
Removed from v.1.184  
changed lines
  Added in v.1.185

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26