In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/94a0894418670e8bdd2c1d63e76a77225365995d?hp=e6bdf523c482703fe07cfe70c76a0efbd6971301>
- Log ----------------------------------------------------------------- commit 94a0894418670e8bdd2c1d63e76a77225365995d Author: Jarkko Hietaniemi <[email protected]> Date: Tue Mar 3 19:15:25 2015 -0500 IRIX: floating point: do not flush to zero Fix for [perl #123767] IRIX64 blead (ddce084a) opbasic/arith.t failure Use the PERL_SYS_FPU_INIT to initialize the FPU flags appropriately. ----------------------------------------------------------------------- Summary of changes: perl.h | 20 ++++++++++++++++++++ t/opbasic/arith.t | 1 + 2 files changed, 21 insertions(+) diff --git a/perl.h b/perl.h index 1df9e71..109ab6a 100644 --- a/perl.h +++ b/perl.h @@ -2918,6 +2918,26 @@ typedef struct padname PADNAME; signal(SIGFPE, SIG_IGN); \ } STMT_END #endif +/* In IRIX the default for Flush to Zero bit is true, + * which means that results going below the minimum of normal + * floating points go to zero, instead of going denormal/subnormal. + * This is unlike almost any other system running Perl, so let's clear it. + * [perl #123767] IRIX64 blead (ddce084a) opbasic/arith.t failure, originally + * [perl #120426] small numbers shouldn't round to zero if they have extra floating digits + * + * XXX The flush-to-zero behaviour should be a Configure scan. + * To change the behaviour usually requires some system-specific + * incantation, though, like the below. */ +#ifdef __sgi +# include <sys/fpu.h> +# define PERL_SYS_FPU_INIT \ + STMT_START { \ + union fpc_csr csr; \ + csr.fc_word = get_fpc_csr(); \ + csr.fc_struct.flush = 0; \ + set_fpc_csr(csr.fc_word); \ + } STMT_END +#endif #ifndef PERL_SYS_FPU_INIT # define PERL_SYS_FPU_INIT NOOP diff --git a/t/opbasic/arith.t b/t/opbasic/arith.t index 3493968..7992260 100644 --- a/t/opbasic/arith.t +++ b/t/opbasic/arith.t @@ -467,6 +467,7 @@ try $T++, 0.153000e-305 != 0.0, '0.153000e-305'; try $T++, 0.1530000e-305 != 0.0, '0.1530000e-305'; try $T++, 0.1530001e-305 != 0.0, '0.1530001e-305'; try $T++, 1.17549435100e-38 != 0.0, 'min single'; +# For flush-to-zero systems this may flush-to-zero, see PERL_SYS_FPU_INIT try $T++, 2.2250738585072014e-308 != 0.0, 'min double'; # string-to-nv should equal float literals -- Perl5 Master Repository
