diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2016-06-25 22:14:41 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2016-07-01 20:43:12 -0400 |
commit | a7157111fed730f765c2c281a61bcde95bacc9ed (patch) | |
tree | 56c9a564cc9164b9c045fcdbbbc91ed4e92e9177 /pp_pack.c | |
parent | c183cd86045c09fcbba056a606ae50f11c9c5b5a (diff) | |
download | perl-a7157111fed730f765c2c281a61bcde95bacc9ed.tar.gz |
VAX: code changes for VAX floats
Mainly to avoid Inf and NaN, which VAX does does not have.
There is something like Inf called "excess" but that is
a deadly exception, seems to manifest itself in vax-netbsd
either as a SIGFPE or SIGSEGV (pretty much untrappable at
least from Perl level).
The range of VAX floats is different from IEEE.
There is positive zero, but no negative zero.
Diffstat (limited to 'pp_pack.c')
-rw-r--r-- | pp_pack.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -2674,7 +2674,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) NV anv; fromstr = NEXTFROM; anv = SvNV(fromstr); -# if defined(VMS) && !defined(_IEEE_FP) +# if (defined(VMS) && !defined(_IEEE_FP)) || defined(DOUBLE_IS_VAX_FLOAT) /* IEEE fp overflow shenanigans are unavailable on VAX and optional * on Alpha; fake it if we don't have them. */ @@ -2684,15 +2684,17 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) afloat = -FLT_MAX; else afloat = (float)anv; # else -#if defined(NAN_COMPARE_BROKEN) && defined(Perl_isnan) +# if defined(NAN_COMPARE_BROKEN) && defined(Perl_isnan) if(Perl_isnan(anv)) afloat = (float)NV_NAN; else -#endif +# endif +# ifdef NV_INF /* a simple cast to float is undefined if outside * the range of values that can be represented */ afloat = (float)(anv > FLT_MAX ? NV_INF : anv < -FLT_MAX ? -NV_INF : anv); +# endif # endif PUSH_VAR(utf8, cur, afloat, needs_swap); } @@ -2703,7 +2705,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist ) NV anv; fromstr = NEXTFROM; anv = SvNV(fromstr); -# if defined(VMS) && !defined(_IEEE_FP) +# if (defined(VMS) && !defined(_IEEE_FP)) || defined(DOUBLE_IS_VAX_FLOAT) /* IEEE fp overflow shenanigans are unavailable on VAX and optional * on Alpha; fake it if we don't have them. */ |