Skip to content

Commit 488307f

Browse files
committed
Revert "Revert "Fallbacks for Perl_fp_class_denorm().""
This reverts commit 2749d03. The original commit: commit e77299d Author: Jarkko Hietaniemi <[email protected]> Date: Mon May 29 09:28:30 2017 +0300 Fallbacks for Perl_fp_class_denorm(). These may be needed if the compiler doesn't expose the C99 math without some special switches. This provides a fix for CentOS 5.
1 parent dc41635 commit 488307f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

perl.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6892,6 +6892,26 @@ extern void moncontrol(int);
68926892
# endif
68936893
#endif
68946894

6895+
/* We have somehow managed not to define the denormal/subnormal
6896+
* detection.
6897+
*
6898+
* This may happen if the compiler doesn't expose the C99 math like
6899+
* the fpclassify() without some special switches. Perl tries to
6900+
* stay C89, so for example -std=c99 is not an option.
6901+
*
6902+
* The Perl_isinf() and Perl_isnan() should have been defined even if
6903+
* the C99 isinf() and isnan() are unavailable, and the NV_MIN becomes
6904+
* from the C89 DBL_MIN or moral equivalent. */
6905+
#if !defined(Perl_fp_class_denorm) && defined(Perl_isinf) && defined(Perl_isnan) && defined(NV_MIN)
6906+
# define Perl_fp_class_denorm(x) ((x) != 0.0 && !Perl_isinf(x) && !Perl_isnan(x) && PERL_ABS(x) < NV_MIN)
6907+
#endif
6908+
6909+
/* This is not a great fallback: subnormals tests will fail,
6910+
* but at least Perl will link and 99.999% of tests will work. */
6911+
#if !defined(Perl_fp_class_denorm)
6912+
# define Perl_fp_class_denorm(x) FALSE
6913+
#endif
6914+
68956915
#ifdef DOUBLE_IS_IEEE_FORMAT
68966916
# define DOUBLE_HAS_INF
68976917
# define DOUBLE_HAS_NAN

0 commit comments

Comments
 (0)