mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-12 20:34:19 +00:00
Fix problems with gcc -ansi.
runtime/mercury_float.h:
Only define MR_is_{nan,infinite,finite} as macros on systems that
support C99.
This commit is contained in:
@@ -211,38 +211,39 @@ void MR_sprintf_float(char *buf, MR_Float f);
|
|||||||
MR_Integer MR_hash_float(MR_Float);
|
MR_Integer MR_hash_float(MR_Float);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** We define MR_is_{nan,infinite} as macros if we support the relevant bits
|
** We define MR_is_{nan,infinite,finite} as macros if we support C99
|
||||||
** of C99 since the resulting code is faster.
|
** since the resulting code is faster.
|
||||||
*/
|
*/
|
||||||
#if defined(MR_USE_SINGLE_PREC_FLOAT) && defined(MR_HAVE_ISNANF)
|
#if __STDC_VERSION__ >= 199901
|
||||||
#define MR_is_nan(f) isnanf((f))
|
#if defined(MR_USE_SINGLE_PREC_FLOAT)
|
||||||
#elif defined(MR_HAVE_ISNAN)
|
#define MR_is_nan(f) isnanf((f))
|
||||||
#define MR_is_nan(f) isnan((f))
|
#else
|
||||||
|
#define MR_is_nan(f) isnan((f))
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#define MR_is_nan(f) MS_is_nan_func((f))
|
#define MR_is_nan(f) MR_is_nan_func((f))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** See comments for function MR_is_infinite_func in mercury_float.c for the
|
** See comments for function MR_is_infinite_func in mercury_float.c for the
|
||||||
** handling of Solaris here.
|
** handling of Solaris here.
|
||||||
*/
|
*/
|
||||||
#if defined(MR_USE_SINGLE_PREC_FLOAT) && defined(MR_HAVE_ISINFF) && !defined(MR_SOLARIS)
|
#if __STDC_VERSION__ >= 199901 && !defined(MR_SOLARIS)
|
||||||
#define MR_is_infinite(f) isinff((f))
|
#if defined(MR_USE_SINGLE_PREC_FLOAT)
|
||||||
#elif defined(MR_HAVE_ISINF) && !defined(MR_SOLARIS)
|
#define MR_is_infinite(f) isinff((f))
|
||||||
#define MR_is_infinite(f) isinf((f))
|
#else
|
||||||
|
#define MR_is_infinite(f) isinf((f))
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#define MR_is_infinite(f) MR_is_infinite_func((f))
|
#define MR_is_infinite(f) MR_is_infinite_func((f))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** XXX I don't know whether isfinite works on Solaris or not.
|
** XXX I don't know whether isfinite works on Solaris or not.
|
||||||
** The finite function apparently does, so we use that instead.
|
|
||||||
*/
|
*/
|
||||||
#if defined(MR_HAVE_ISFINITE) && !defined(MR_SOLARIS)
|
#if __STDC_VERSION__ >= 199901 && !defined(MR_SOLARIS)
|
||||||
#define MR_is_finite(f) isfinite((f))
|
#define MR_is_finite(f) isfinite((f))
|
||||||
#elif defined(MR_HAVE_FINITE)
|
#else
|
||||||
#define MR_is_finite(f) finite((f))
|
|
||||||
#else
|
|
||||||
#define MR_is_finite(f) (!MR_is_infinite((f)) && !MR_is_nan((f)))
|
#define MR_is_finite(f) (!MR_is_infinite((f)) && !MR_is_nan((f)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user