summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-08-21 16:57:06 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-08-22 10:29:58 -0400
commit33e375297c57caaebbe33d5e1b22b0c92aa1ba3b (patch)
treecd83d5bedb7d47418ace3ea3a8606a36920a0159
parentae776a2c5b3301aa9b0e900ee4b132db312a636b (diff)
downloadperl-33e375297c57caaebbe33d5e1b22b0c92aa1ba3b.tar.gz
Unify inf/nan printf output to Inf, -Inf, and NaN.
(Bypassing the native strtod.)
-rw-r--r--sv.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sv.c b/sv.c
index 288a1e8031..eee50a2292 100644
--- a/sv.c
+++ b/sv.c
@@ -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';