mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-24 05:21:20 -08:00
Use isfinite/isnan as macros, like C99 prescribes. Needed for long double support in OS X
This commit is contained in:
parent
84a8e1fc80
commit
7664b83dac
3 changed files with 7 additions and 14 deletions
|
|
@ -24,10 +24,6 @@
|
|||
#include <float.h>
|
||||
#include <ecl/internal.h>
|
||||
|
||||
#ifndef HAVE_ISNANF
|
||||
#define isnanf(x) isnan(x)
|
||||
#endif
|
||||
|
||||
#ifndef M_PI
|
||||
# ifdef PI
|
||||
# define M_PI PI
|
||||
|
|
@ -161,10 +157,10 @@ ecl_make_singlefloat(float f)
|
|||
ecl_detect_fpe();
|
||||
if (f == (float)0.0)
|
||||
return(cl_core.singlefloat_zero);
|
||||
if (isnanf(f)) {
|
||||
if (isnan(f)) {
|
||||
cl_error(1, @'division-by-zero');
|
||||
}
|
||||
if (!finite(f)) {
|
||||
if (!isfinite(f)) {
|
||||
cl_error(1, @'floating-point-overflow');
|
||||
}
|
||||
x = cl_alloc_object(t_singlefloat);
|
||||
|
|
@ -183,7 +179,7 @@ ecl_make_doublefloat(double f)
|
|||
if (isnan(f)) {
|
||||
cl_error(1, @'division-by-zero');
|
||||
}
|
||||
if (!finite(f)) {
|
||||
if (!isfinite(f)) {
|
||||
cl_error(1, @'floating-point-overflow');
|
||||
}
|
||||
x = cl_alloc_object(t_doublefloat);
|
||||
|
|
@ -200,10 +196,10 @@ make_longfloat(long double f)
|
|||
ecl_detect_fpe();
|
||||
if (f == (long double)0.0)
|
||||
return cl_core.longfloat_zero;
|
||||
if (isnanl(f)) {
|
||||
if (isnan(f)) {
|
||||
cl_error(1, @'division-by-zero');
|
||||
}
|
||||
if (!finite(f)) {
|
||||
if (!isfinite(f)) {
|
||||
cl_error(1, @'floating-point-overflow');
|
||||
}
|
||||
x = cl_alloc_object(t_longfloat);
|
||||
|
|
|
|||
|
|
@ -493,8 +493,6 @@ write_base(int base, cl_object stream)
|
|||
#define G_EXP_STRING "Lg"
|
||||
#define DBL_TYPE long double
|
||||
#define strtod strtold
|
||||
#define isnan isnanl
|
||||
#define finite finitel
|
||||
extern long double strtold(const char *nptr, char **endptr);
|
||||
#else
|
||||
#define EXP_STRING "e"
|
||||
|
|
@ -510,8 +508,7 @@ int edit_double(int n, DBL_TYPE d, int *sp, char *s, int *ep)
|
|||
fenv_t env;
|
||||
feholdexcept(&env);
|
||||
#endif
|
||||
|
||||
if (isnan(d) || !finite(d))
|
||||
if (isnan(d) || !isfinite(d))
|
||||
FEerror("Can't print a non-number.", 0);
|
||||
if (n < -DBL_MAX_DIGITS)
|
||||
n = DBL_MAX_DIGITS;
|
||||
|
|
|
|||
|
|
@ -464,7 +464,7 @@ AC_CHECK_FUNCS( [floor getcwd gethostbyaddr gethostbyname getpagesize] \
|
|||
[strcasecmp strchr strerror strtol] )
|
||||
dnl !!! end autoscan
|
||||
|
||||
AC_CHECK_FUNCS( [nanosleep alarm times isnanf select setenv putenv] \
|
||||
AC_CHECK_FUNCS( [nanosleep alarm times select setenv putenv] \
|
||||
[lstat mkstemp sigprocmask isatty feenableexcept tzset] \
|
||||
[gettimeofday getrusage] )
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue