summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-08-22 07:48:57 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-08-22 10:29:59 -0400
commit87190886599fa88a90d49de6fabe535bdddfc4d9 (patch)
tree29a8a0dbb7edf71e650faf703b9bd744f42e8e62
parentf279e099583af966dcd3a221c19eed403a683ec2 (diff)
downloadperl-87190886599fa88a90d49de6fabe535bdddfc4d9.tar.gz
Perl_isinf and Perl_isfinite enhancements.
-rw-r--r--perl.h33
1 files 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.