In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/fdb7e3a630fea8155647331d5f9e2a4a0384adba?hp=1197364c62629966dfaf5c3da0a72ea051ed91c2>
- Log ----------------------------------------------------------------- commit fdb7e3a630fea8155647331d5f9e2a4a0384adba Author: Craig A. Berry <craigbe...@mac.com> Date: Sat Sep 20 10:40:35 2014 -0500 Fix NaN double to long double conversion on VMS. Promotion from double to long double on VMS is apparently done via the math routine OTS$CVT_FLOAT_T_X, which seems to do the right thing for ordinary values, infinities, and signaling NaNs. But for quiet NaNs (and only on Itanium, not Alpha) it produces a negative infinity rather than a NaN. Oops. So hack around that by detecting NaN in the double and explicitly setting it in the long double. We can't use NV_NAN because this is the code path in Perl_sv_vcatpvfn_flags where we have not configured long doubles but are using the "fv" long double to format output. ----------------------------------------------------------------------- Summary of changes: sv.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sv.c b/sv.c index 53b4f8b..b22f770 100644 --- a/sv.c +++ b/sv.c @@ -11098,10 +11098,17 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p long double fv; # define FV_ISFINITE(x) Perl_isfinitel(x) # define FV_GF PERL_PRIgldbl +# if defined(__VMS) && defined(__ia64) && defined(__IEEE_FLOAT) + /* Work around breakage in OTS$CVT_FLOAT_T_X */ +# define NV_TO_FV(nvsv) (Perl_isnan(SvNV(nvsv)) ? LDBL_SNAN : SvNV(nvsv)); +# else +# define NV_TO_FV SvNV +# endif #else NV fv; # define FV_ISFINITE(x) Perl_isfinite((NV)(x)) # define FV_GF NVgf +# define NV_TO_FV SvNV #endif STRLEN have; STRLEN need; @@ -11844,7 +11851,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p #endif } else - fv = SvNV(argsv); + fv = NV_TO_FV(argsv); need = 0; /* frexp() (or frexpl) has some unspecified behaviour for -- Perl5 Master Repository