From a7157111fed730f765c2c281a61bcde95bacc9ed Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Sat, 25 Jun 2016 22:14:41 -0400 Subject: 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. --- sv.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'sv.c') diff --git a/sv.c b/sv.c index 2ceec5a950..1e294ddb3d 100644 --- a/sv.c +++ b/sv.c @@ -2097,15 +2097,19 @@ S_sv_setnv(pTHX_ SV* sv, int numtype) { bool pok = cBOOL(SvPOK(sv)); bool nok = FALSE; +#ifdef NV_INF if ((numtype & IS_NUMBER_INFINITY)) { SvNV_set(sv, (numtype & IS_NUMBER_NEG) ? -NV_INF : NV_INF); nok = TRUE; - } - else if ((numtype & IS_NUMBER_NAN)) { + } else +#endif +#ifdef NV_NAN + if ((numtype & IS_NUMBER_NAN)) { SvNV_set(sv, NV_NAN); nok = TRUE; - } - else if (pok) { + } else +#endif + if (pok) { SvNV_set(sv, Atof(SvPVX_const(sv))); /* Purposefully no true nok here, since we don't want to blow * away the possible IOK/UV of an existing sv. */ -- cgit v1.2.1