diff options
author | Paul Green <Paul.Green@stratus.com> | 2002-04-03 11:34:00 -0500 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-04-03 22:25:48 +0000 |
commit | 5cdb9e01810f44637efb0630e44e195ac382ea91 (patch) | |
tree | 597e3503c7e38fbff2292ed94c973fb69a3e703e /pp_pack.c | |
parent | 0bf62e3bca1224fdabdadd4b564dfb18d90a7373 (diff) | |
download | perl-5cdb9e01810f44637efb0630e44e195ac382ea91.tar.gz |
pp_pack.c - remove SIGFPE on VOS
Message-Id: <200204032134.QAA29744@mailhub2.stratus.com>
p4raw-id: //depot/perl@15722
Diffstat (limited to 'pp_pack.c')
-rw-r--r-- | pp_pack.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -2052,14 +2052,42 @@ Perl_pack_cat(pTHX_ SV *cat, char *pat, register char *patend, register SV **beg case 'f': while (len-- > 0) { fromstr = NEXTFROM; +#ifdef __VOS__ +/* VOS does not automatically map a floating-point overflow + during conversion from double to float into infinity, so we + do it by hand. This code should either be generalized for + any OS that needs it, or removed if and when VOS implements + posix-976 (suggestion to support mapping to infinity). + Paul.Green@stratus.com 02-04-02. */ + if (SvNV(fromstr) > FLT_MAX) + afloat = _float_constants[0]; /* single prec. inf. */ + else if (SvNV(fromstr) < -FLT_MAX) + afloat = _float_constants[0]; /* single prec. inf. */ + else afloat = (float)SvNV(fromstr); +#else afloat = (float)SvNV(fromstr); +#endif sv_catpvn(cat, (char *)&afloat, sizeof (float)); } break; case 'd': while (len-- > 0) { fromstr = NEXTFROM; +#ifdef __VOS__ +/* VOS does not automatically map a floating-point overflow + during conversion from long double to double into infinity, + so we do it by hand. This code should either be generalized + for any OS that needs it, or removed if and when VOS + implements posix-976 (suggestion to support mapping to + infinity). Paul.Green@stratus.com 02-04-02. */ + if (SvNV(fromstr) > DBL_MAX) + adouble = _double_constants[0]; /* double prec. inf. */ + else if (SvNV(fromstr) < -DBL_MAX) + adouble = _double_constants[0]; /* double prec. inf. */ + else adouble = (double)SvNV(fromstr); +#else adouble = (double)SvNV(fromstr); +#endif sv_catpvn(cat, (char *)&adouble, sizeof (double)); } break; |