diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2014-09-24 16:23:11 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2014-09-26 17:04:52 -0400 |
commit | a308b05acde5d644385536b0b51b622a5d7c0dae (patch) | |
tree | 4b53b019501bec7bc6a7c555db6737555608b3dd /perl.h | |
parent | 877206dfe0caef9a95cc20c69822774122a32361 (diff) | |
download | perl-a308b05acde5d644385536b0b51b622a5d7c0dae.tar.gz |
Tru64: introduce PERL_SYS_FPU_INIT, use it.
In Tru64 the cc -ieee enables the IEEE math but disables traps.
We need to reenable the "invalid" trap because otherwise generation
of NaN values leaves the IEEE fp flags in bad state, leaving any further
fp ops behaving strangely (Inf + 1 resulting in zero, for example).
Diffstat (limited to 'perl.h')
-rw-r--r-- | perl.h | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -2898,6 +2898,23 @@ typedef SV PADNAME; # define PERL_FPU_POST_EXEC } #endif +/* In Tru64 the cc -ieee enables the IEEE math but disables traps. + * We need to reenable the "invalid" trap because otherwise generation + * of NaN values leaves the IEEE fp flags in bad state, leaving any further + * fp ops behaving strangely (Inf + 1 resulting in zero, for example). */ +#ifdef __osf__ +# include <machine/fpu.h> +# define PERL_SYS_FPU_INIT \ + STMT_START { \ + ieee_set_fp_control(IEEE_TRAP_ENABLE_INV); \ + signal(SIGFPE, SIG_IGN); \ + } STMT_END +#endif + +#ifndef PERL_SYS_FPU_INIT +# define PERL_SYS_FPU_INIT NOOP +#endif + #ifndef PERL_SYS_INIT3_BODY # define PERL_SYS_INIT3_BODY(argvp,argcp,envp) PERL_SYS_INIT_BODY(argvp,argcp) #endif |