mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-26 06:22:33 -08:00
ieee-fp: fix ext:float-{infinity/nan}-p
ext:float-infinity-p returned true for NaNs and ext:float-nan-p was slower than necessary.
This commit is contained in:
parent
5c7aecc15f
commit
fa28f08770
1 changed files with 13 additions and 14 deletions
|
|
@ -64,17 +64,16 @@ si_float_infinity_p(cl_object x)
|
|||
bool
|
||||
ecl_float_nan_p(cl_object x)
|
||||
{
|
||||
return !ecl_number_equalp(x,x);
|
||||
/* switch (ecl_t_of(x)) { */
|
||||
/* case t_singlefloat: */
|
||||
/* return !isnan(ecl_single_float(x)); */
|
||||
/* case t_doublefloat: */
|
||||
/* return !isnan(ecl_double_float(x)); */
|
||||
/* case t_longfloat: */
|
||||
/* return !isnan(ecl_long_float(x)); */
|
||||
/* default: */
|
||||
/* return 0; */
|
||||
/* } */
|
||||
switch (ecl_t_of(x)) {
|
||||
case t_singlefloat:
|
||||
return isnan(ecl_single_float(x));
|
||||
case t_doublefloat:
|
||||
return isnan(ecl_double_float(x));
|
||||
case t_longfloat:
|
||||
return isnan(ecl_long_float(x));
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -82,11 +81,11 @@ ecl_float_infinity_p(cl_object x)
|
|||
{
|
||||
switch (ecl_t_of(x)) {
|
||||
case t_singlefloat:
|
||||
return !isfinite(ecl_single_float(x));
|
||||
return isinf(ecl_single_float(x));
|
||||
case t_doublefloat:
|
||||
return !isfinite(ecl_double_float(x));
|
||||
return isinf(ecl_double_float(x));
|
||||
case t_longfloat:
|
||||
return !isfinite(ecl_long_float(x));
|
||||
return isinf(ecl_long_float(x));
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue