diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2014-08-24 18:34:05 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2014-08-24 22:31:49 -0400 |
commit | 1a322af203cb5af4d63f8aab7200b508d14420ff (patch) | |
tree | 72c8457913d704b6c9fe28f170ed90e866d5402b /perl.h | |
parent | 8c12dc63d1f47b22b69bbcfe5c21dcadb14c5397 (diff) | |
download | perl-1a322af203cb5af4d63f8aab7200b508d14420ff.tar.gz |
More is_inf() et alia dance.
Too many almost similar interfaces.
Most importantly go for isinf() and isnan() if available,
instead of going for the labyrinth of *fp*class* interfaces.
Diffstat (limited to 'perl.h')
-rw-r--r-- | perl.h | 53 |
1 files changed, 36 insertions, 17 deletions
@@ -1980,6 +1980,23 @@ EXTERN_C long double modfl(long double, long double *); # define Perl_modf(x,y) modf(x,y) # define Perl_frexp(x,y) frexp(x,y) # define Perl_ldexp(x,y) ldexp(x,y) +# ifndef Perl_isnan +# ifdef HAS_ISNAN +# define Perl_isnan(x) isnan(x) +# endif +# endif +# ifndef Perl_isinf +# if defined(HAS_ISINF) +# define Perl_isinf(x) isinf(x) +# endif +# endif +# ifndef Perl_isfinite +# ifdef HAS_ISFINITE +# define Perl_isfinite(x) isfinite(x) +# elif defined(HAS_FINITE) +# define Perl_isfinite(x) finite(x) +# endif +# endif #endif /* Solaris and IRIX have fpclass/fpclassl, but they are using @@ -2061,12 +2078,12 @@ EXTERN_C long double modfl(long double, long double *); #if !defined(Perl_fp_class) && defined(HAS_FPCLASSIFY) # include <math.h> # define Perl_fp_class(x) fpclassify(x) -# define Perl_fp_class_inf(x) (fp_classify(x)==FP_INFINITE) -# define Perl_fp_class_snan(x) (fp_classify(x)==FP_SNAN) -# define Perl_fp_class_qnan(x) (fp_classify(x)==FP_QNAN) -# define Perl_fp_class_norm(x) (fp_classify(x)==FP_NORMAL) -# define Perl_fp_class_denorm(x) (fp_classify(x)==FP_SUBNORMAL) -# define Perl_fp_class_zero(x) (fp_classify(x)==FP_ZERO) +# define Perl_fp_class_inf(x) (fpclassify(x)==FP_INFINITE) +# define Perl_fp_class_snan(x) (fpclassify(x)==FP_SNAN) +# define Perl_fp_class_qnan(x) (fpclassify(x)==FP_QNAN) +# define Perl_fp_class_norm(x) (fpclassify(x)==FP_NORMAL) +# define Perl_fp_class_denorm(x) (fpclassify(x)==FP_SUBNORMAL) +# define Perl_fp_class_zero(x) (fpclassify(x)==FP_ZERO) #endif #if !defined(Perl_fp_class) && defined(HAS_CLASS) @@ -2144,24 +2161,26 @@ EXTERN_C long double modfl(long double, long double *); (Perl_fp_class_pdenorm(x) || Perl_fp_class_ndenorm(x)) #endif +#ifdef UNDER_CE +int isnan(double d); +#endif + #ifndef Perl_isnan -# ifdef HAS_ISNAN -# define Perl_isnan(x) isnan((double)x) +# ifdef Perl_fp_class_nan +# define Perl_isnan(x) Perl_fp_class_nan(x) # else -# ifdef Perl_fp_class_nan -# define Perl_isnan(x) Perl_fp_class_nan(x) +# ifdef HAS_UNORDERED +# define Perl_isnan(x) unordered((x), 0.0) # else -# ifdef HAS_UNORDERED -# define Perl_isnan(x) unordered((x), 0.0) -# else -# define Perl_isnan(x) ((x)!=(x)) -# endif +# define Perl_isnan(x) ((x)!=(x)) # endif # endif #endif -#ifdef UNDER_CE -int isnan(double d); +#ifndef Perl_isinf +# ifdef Perl_fp_class_inf +# define Perl_isinf(x) Perl_fp_class_inf(x) +# endif #endif #ifndef Perl_isfinite |