/[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.161 by mvo, Mon May 6 22:33:10 2002 UTC revision 1.162 by mvo, Wed May 8 20:08:16 2002 UTC
# Line 47  Line 47 
47    
48  #include <math.h>  #include <math.h>
49  #include <ctype.h>  #include <ctype.h>
50    #include <string.h>
51  #include "libguile/_scm.h"  #include "libguile/_scm.h"
52  #include "libguile/feature.h"  #include "libguile/feature.h"
53  #include "libguile/ports.h"  #include "libguile/ports.h"
# Line 2793  mem2complex (const char* mem, size_t len Line 2794  mem2complex (const char* mem, size_t len
2794      }      }
2795    else    else
2796      {      {
2797        if (sign == -1)        if (sign == -1 && SCM_FALSEP (scm_nan_p (ureal)))
2798          ureal = scm_difference (ureal, SCM_UNDEFINED);          ureal = scm_difference (ureal, SCM_UNDEFINED);
2799    
2800        if (idx == len)        if (idx == len)
# Line 2844  mem2complex (const char* mem, size_t len Line 2845  mem2complex (const char* mem, size_t len
2845                if (idx != len)                if (idx != len)
2846                  return SCM_BOOL_F;                  return SCM_BOOL_F;
2847    
2848                if (sign == -1)                if (sign == -1 && SCM_FALSEP (scm_nan_p (ureal)))
2849                  angle = scm_difference (angle, SCM_UNDEFINED);                  angle = scm_difference (angle, SCM_UNDEFINED);
2850    
2851                result = scm_make_polar (ureal, angle);                result = scm_make_polar (ureal, angle);
# Line 2864  mem2complex (const char* mem, size_t len Line 2865  mem2complex (const char* mem, size_t len
2865    
2866                if (SCM_FALSEP (imag))                if (SCM_FALSEP (imag))
2867                  imag = SCM_MAKINUM (sign);                  imag = SCM_MAKINUM (sign);
2868                else if (sign == -1)                else if (sign == -1 && SCM_FALSEP (scm_nan_p (ureal)))
2869                  imag = scm_difference (imag, SCM_UNDEFINED);                  imag = scm_difference (imag, SCM_UNDEFINED);
2870    
2871                if (idx == len)                if (idx == len)
# Line 3284  scm_leq_p (SCM x, SCM y) Line 3285  scm_leq_p (SCM x, SCM y)
3285      SCM_WTA_DISPATCH_2 (g_leq_p, x, y, SCM_ARG1, FUNC_NAME);      SCM_WTA_DISPATCH_2 (g_leq_p, x, y, SCM_ARG1, FUNC_NAME);
3286    else if (!SCM_NUMBERP (y))    else if (!SCM_NUMBERP (y))
3287      SCM_WTA_DISPATCH_2 (g_leq_p, x, y, SCM_ARG2, FUNC_NAME);      SCM_WTA_DISPATCH_2 (g_leq_p, x, y, SCM_ARG2, FUNC_NAME);
3288      else if (SCM_NFALSEP (scm_nan_p (x)) || SCM_NFALSEP (scm_nan_p (y)))
3289        return SCM_BOOL_F;
3290    else    else
3291      return SCM_BOOL_NOT (scm_less_p (y, x));      return SCM_BOOL_NOT (scm_less_p (y, x));
3292  }  }
# Line 3302  scm_geq_p (SCM x, SCM y) Line 3305  scm_geq_p (SCM x, SCM y)
3305      SCM_WTA_DISPATCH_2 (g_geq_p, x, y, SCM_ARG1, FUNC_NAME);      SCM_WTA_DISPATCH_2 (g_geq_p, x, y, SCM_ARG1, FUNC_NAME);
3306    else if (!SCM_NUMBERP (y))    else if (!SCM_NUMBERP (y))
3307      SCM_WTA_DISPATCH_2 (g_geq_p, x, y, SCM_ARG2, FUNC_NAME);      SCM_WTA_DISPATCH_2 (g_geq_p, x, y, SCM_ARG2, FUNC_NAME);
3308      else if (SCM_NFALSEP (scm_nan_p (x)) || SCM_NFALSEP (scm_nan_p (y)))
3309        return SCM_BOOL_F;
3310    else    else
3311    return SCM_BOOL_NOT (scm_less_p (x, y));      return SCM_BOOL_NOT (scm_less_p (x, y));
3312  }  }
3313  #undef FUNC_NAME  #undef FUNC_NAME
3314    
# Line 4479  SCM_DEFINE (scm_inexact_to_exact, "inexa Line 4484  SCM_DEFINE (scm_inexact_to_exact, "inexa
4484      if (SCM_FIXABLE (lu)) {      if (SCM_FIXABLE (lu)) {
4485        return SCM_MAKINUM (lu);        return SCM_MAKINUM (lu);
4486  #ifdef SCM_BIGDIG  #ifdef SCM_BIGDIG
4487      } else if (isfinite (u)) {      } else if (isfinite (u) && !xisnan (u)) {
4488        return scm_i_dbl2big (u);        return scm_i_dbl2big (u);
4489  #endif  #endif
4490      } else {      } else {

Legend:
Removed from v.1.161  
changed lines
  Added in v.1.162

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