diff options
author | Sawyer X <xsawyerx@cpan.org> | 2017-09-28 22:34:39 +0200 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2018-03-12 13:06:44 +0000 |
commit | e1f1d106200acba110ec32eacb5dd6e13b744d2d (patch) | |
tree | 5e262aa3745bd325a95d99950d083afefcb6dcec /perl.h | |
parent | 1e4ebce09b6f4055f05bb265cdb3777377e82e1c (diff) | |
download | perl-e1f1d106200acba110ec32eacb5dd6e13b744d2d.tar.gz |
Revert "Revert "Fallbacks for Perl_fp_class_denorm().""
This reverts commit 2749d0395cc1e21d69af38cde41490699fc6e3ab.
The original commit:
commit e77299d3416e7e737523afdc0642734205e46d59
Author: Jarkko Hietaniemi <jhi@iki.fi>
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.
(cherry picked from commit 488307ffa67ce70fc9755e560a74dac04bdcb0e4)
Diffstat (limited to 'perl.h')
-rw-r--r-- | perl.h | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -6873,6 +6873,26 @@ extern void moncontrol(int); # endif #endif +/* We have somehow managed not to define the denormal/subnormal + * detection. + * + * This may happen if the compiler doesn't expose the C99 math like + * the fpclassify() without some special switches. Perl tries to + * stay C89, so for example -std=c99 is not an option. + * + * The Perl_isinf() and Perl_isnan() should have been defined even if + * the C99 isinf() and isnan() are unavailable, and the NV_MIN becomes + * from the C89 DBL_MIN or moral equivalent. */ +#if !defined(Perl_fp_class_denorm) && defined(Perl_isinf) && defined(Perl_isnan) && defined(NV_MIN) +# define Perl_fp_class_denorm(x) ((x) != 0.0 && !Perl_isinf(x) && !Perl_isnan(x) && PERL_ABS(x) < NV_MIN) +#endif + +/* This is not a great fallback: subnormals tests will fail, + * but at least Perl will link and 99.999% of tests will work. */ +#if !defined(Perl_fp_class_denorm) +# define Perl_fp_class_denorm(x) FALSE +#endif + #ifdef DOUBLE_IS_IEEE_FORMAT # define DOUBLE_HAS_INF # define DOUBLE_HAS_NAN |