summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dragan <bulk88@hotmail.com>2015-05-19 13:22:40 -0400
committerRicardo Signes <rjbs@cpan.org>2015-05-20 20:37:58 -0400
commitd22fb6ca0a489331fea369e4ab9a5d4013de1bb0 (patch)
tree1ed78b4089676747256924ed8ac6ce90cb813559
parent3b50e657ec7db1b772838d00793c724c0e61382a (diff)
downloadperl-d22fb6ca0a489331fea369e4ab9a5d4013de1bb0.tar.gz
pack('f', $NAN) must account for NAN_COMPARE_BROKEN platforms
VC6 was returning either packed float +inf or packed float -inf (I dont remember) instead of packed float NAN in t/op/infnan.t . This fixes #125203
-rw-r--r--pp_pack.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/pp_pack.c b/pp_pack.c
index 1d732a8bf7..cf1074e23d 100644
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -2672,6 +2672,11 @@ 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(Perl_isnan(anv))
+ afloat = (float)NV_NAN;
+ else
+#endif
/* a simple cast to float is undefined if outside
* the range of values that can be represented */
afloat = (float)(anv > FLT_MAX ? NV_INF :