diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2014-08-21 16:57:06 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2014-08-22 10:29:58 -0400 |
commit | 33e375297c57caaebbe33d5e1b22b0c92aa1ba3b (patch) | |
tree | cd83d5bedb7d47418ace3ea3a8606a36920a0159 | |
parent | ae776a2c5b3301aa9b0e900ee4b132db312a636b (diff) | |
download | perl-33e375297c57caaebbe33d5e1b22b0c92aa1ba3b.tar.gz |
Unify inf/nan printf output to Inf, -Inf, and NaN.
(Bypassing the native strtod.)
-rw-r--r-- | sv.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -12007,6 +12007,20 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p elen = width; } } + else if (Perl_isinf(nv)) { + if (nv > 0.0) { + elen = 4; + Copy("Inf", PL_efloatbuf, elen, char); + } + else { + elen = 5; + Copy("-Inf", PL_efloatbuf, elen, char); + } + } + else if (Perl_isnan(nv)) { + elen = 4; + Copy("NaN", PL_efloatbuf, elen, char); + } else { char *ptr = ebuf + sizeof ebuf; *--ptr = '\0'; |