diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-08-27 10:52:02 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-08-27 12:41:30 +0900 |
commit | 04be8e84db1cf4f8b2a7bc7679eda4336da75d43 (patch) | |
tree | c7914614f4a5cf91109f7893b87ff9e5d143ad0e /include/ruby/missing.h | |
parent | 37114673623c4d2b1d9f2c2ddfffba070b2d96e6 (diff) |
Use C99-defined macros to classify a floating-point number
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4783
Diffstat (limited to 'include/ruby/missing.h')
-rw-r--r-- | include/ruby/missing.h | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/include/ruby/missing.h b/include/ruby/missing.h index 7d551248ae..a4a2bbb8ee 100644 --- a/include/ruby/missing.h +++ b/include/ruby/missing.h @@ -92,10 +92,6 @@ RUBY_EXTERN int eaccess(const char*, int); RUBY_EXTERN double round(double); /* numeric.c */ #endif -#ifndef HAVE_FINITE -RUBY_EXTERN int finite(double); -#endif - #ifndef HAVE_FLOCK RUBY_EXTERN int flock(int, int); #endif @@ -152,35 +148,9 @@ RUBY_EXTERN const union bytesequence4_or_float rb_nan; # define HUGE_VAL ((double)INFINITY) #endif -#if defined(isinf) -# /* Take that. */ -#elif defined(HAVE_ISINF) -# /* Take that. */ -#elif defined(HAVE_FINITE) && defined(HAVE_ISNAN) -# define isinf(x) (!finite(x) && !isnan(x)) -#elif defined(__cplusplus) && __cplusplus >= 201103L -# // <cmath> must include constexpr bool isinf(double); -#else -RUBY_EXTERN int isinf(double); -#endif - -#if defined(isnan) -# /* Take that. */ -#elif defined(HAVE_ISNAN) -# /* Take that. */ -#elif defined(__cplusplus) && __cplusplus >= 201103L -# // <cmath> must include constexpr bool isnan(double); -#else -RUBY_EXTERN int isnan(double); -#endif - -#if defined(isfinite) -# /* Take that. */ -#elif defined(HAVE_ISFINITE) -# /* Take that. */ -#else -# define HAVE_ISFINITE 1 -# define isfinite(x) finite(x) +#ifndef HAVE_FINITE +# define HAVE_FINITE 1 +# define finite(x) isfinite(x) #endif #ifndef HAVE_NAN |