Merge branch 'develop' into 'develop'

Fix comparision of floating point infinities and NaNs with ratios/bignums

See merge request !86
This commit is contained in:
Daniel Kochmański 2017-08-29 14:23:47 +00:00
commit d898a9efdb
2 changed files with 17 additions and 1 deletions

View file

@ -99,7 +99,7 @@ ecl_expt(cl_object x, cl_object y)
FEwrong_type_nth_arg(@[expt], 1, x, @[number]);
}
if (ecl_zerop(x)) {
z = ecl_times(x, y);
z = x;
if (!ecl_plusp(ty==t_complex?y->complex.real:y))
z = ecl_divide(ecl_make_fixnum(1), z);
} else if (ty != t_fixnum && ty != t_bignum) {

View file

@ -71,6 +71,10 @@ ecl_number_equalp(cl_object x, cl_object y)
case t_doublefloat:
#ifdef ECL_LONG_FLOAT
case t_longfloat:
#endif
#ifdef ECL_IEEE_FP
if(ecl_float_nan_p(y) || ecl_float_infinity_p(y))
return 0;
#endif
y = cl_rational(y);
goto BEGIN;
@ -91,6 +95,10 @@ ecl_number_equalp(cl_object x, cl_object y)
case t_doublefloat:
#ifdef ECL_LONG_FLOAT
case t_longfloat:
#endif
#ifdef ECL_IEEE_FP
if(ecl_float_nan_p(y) || ecl_float_infinity_p(y))
return 0;
#endif
y = cl_rational(y);
goto BEGIN;
@ -110,6 +118,10 @@ ecl_number_equalp(cl_object x, cl_object y)
return double_fix_compare(ecl_fixnum(y), dx) == 0;
case t_bignum:
case t_ratio:
#ifdef ECL_IEEE_FP
if(ecl_float_nan_p(x) || ecl_float_infinity_p(x))
return 0;
#endif
x = cl_rational(x);
goto BEGIN;
case t_singlefloat:
@ -133,6 +145,10 @@ ecl_number_equalp(cl_object x, cl_object y)
return long_double_fix_compare(ecl_fixnum(y), dx) == 0;
case t_bignum:
case t_ratio:
#ifdef ECL_IEEE_FP
if(ecl_float_nan_p(x) || ecl_float_infinity_p(x))
return 0;
#endif
x = cl_rational(x);
goto BEGIN;
case t_singlefloat: