summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2016-06-25 22:14:41 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2016-07-01 20:43:12 -0400
commita7157111fed730f765c2c281a61bcde95bacc9ed (patch)
tree56c9a564cc9164b9c045fcdbbbc91ed4e92e9177 /sv.c
parentc183cd86045c09fcbba056a606ae50f11c9c5b5a (diff)
downloadperl-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 'sv.c')
-rw-r--r--sv.c12
1 files changed, 8 insertions, 4 deletions
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. */