From 87190886599fa88a90d49de6fabe535bdddfc4d9 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Fri, 22 Aug 2014 07:48:57 -0400 Subject: Perl_isinf and Perl_isfinite enhancements. --- perl.h | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/perl.h b/perl.h index caea50f4b9..bc4209f43c 100644 --- a/perl.h +++ b/perl.h @@ -1922,13 +1922,8 @@ EXTERN_C long double modfl(long double, long double *); # endif # endif # ifndef Perl_isinf -# if defined(HAS_ISFINITEL) && defined(Perl_isnan) -# define Perl_isinf(x) !(isfinitel(x)||Perl_isnan(x)) -# endif -# endif -# ifndef Perl_isinf -# if defined(HAS_FINITEL) && defined(Perl_isnan) -# define Perl_isinf(x) !(finitel(x)||Perl_isnan(x)) +# if defined(HAS_ISINFL) +# define Perl_isinf(x) isinfl(x) # endif # endif # ifndef Perl_isfinite @@ -2151,7 +2146,7 @@ EXTERN_C long double modfl(long double, long double *); #ifndef Perl_isnan # ifdef HAS_ISNAN -# define Perl_isnan(x) isnan((NV)x) +# define Perl_isnan(x) isnan((double)x) # else # ifdef Perl_fp_class_nan # define Perl_isnan(x) Perl_fp_class_nan(x) @@ -2169,23 +2164,11 @@ EXTERN_C long double modfl(long double, long double *); int isnan(double d); #endif -#ifndef Perl_isinf -# ifdef HAS_ISINF -# define Perl_isinf(x) isinf((NV)x) -# else -# ifdef Perl_fp_class_inf -# define Perl_isinf(x) Perl_fp_class_inf(x) -# else -# define Perl_isinf(x) ((x)==NV_INF) -# endif -# endif -#endif - #ifndef Perl_isfinite # ifdef HAS_ISFINITE -# define Perl_isfinite(x) isfinite((NV)x) +# define Perl_isfinite(x) isfinite((double)x) # elif defined(HAS_FINITE) -# define Perl_isfinite(x) finite((NV)x) +# define Perl_isfinite(x) finite((double)x) # elif defined(Perl_fp_class_finite) # define Perl_isfinite(x) Perl_fp_class_finite(x) # elif defined(Perl_is_inf) && defined(Perl_is_nan) @@ -2196,6 +2179,12 @@ int isnan(double d); # endif #endif +#ifndef Perl_isinf +# if defined(Perl_isfinite) && defined(Perl_isnan) +# define Perl_isinf(x) !(Perl_isfinite(x)||Perl_isnan(x)) +# endif +#endif + /* The default is to use Perl's own atof() implementation (in numeric.c). * Usually that is the one to use but for some platforms (e.g. UNICOS) * it is however best to use the native implementation of atof. -- cgit v1.2.1