Skip to content

Commit

Permalink
pack('f', $NAN) must account for NAN_COMPARE_BROKEN platforms
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bulk88 authored and rjbs committed May 21, 2015
1 parent 3b50e65 commit d22fb6c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pp_pack.c
Expand Up @@ -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 :
Expand Down

0 comments on commit d22fb6c

Please sign in to comment.