summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2015-01-25 09:42:19 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2015-01-28 06:52:31 -0500
commitfae4db12fe48a8d53b803281652815abd8bc98c0 (patch)
treeb0b229295fd2d300e98d7899beabdd2c95990331 /numeric.c
parent0c5a1073d3e8debefdaa5b534337acb1b0c060ef (diff)
downloadperl-fae4db12fe48a8d53b803281652815abd8bc98c0.tar.gz
infnan: Allow 1.#INF00 and 1.#IND00
Windowese for inf and nan. The exact number of trailing zeros seems to vary, maybe controlled by printf precision? Or RTL dependent?
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/numeric.c b/numeric.c
index 9e05d556da..ddb6111ded 100644
--- a/numeric.c
+++ b/numeric.c
@@ -650,13 +650,21 @@ Perl_grok_infnan(const char** sp, const char* send)
!(isALPHA_FOLD_EQ(*s, 'Y') ||
isALPHA_FOLD_EQ(*s, 'E'))) return 0;
s++; if (s < send) return 0;
- } else if (*s)
- return 0;
+ } else {
+ while (*s == '0') { /* 1.#INF00 */
+ s++;
+ }
+ if (*s)
+ return 0;
+ }
flags |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT;
}
else if (isALPHA_FOLD_EQ(*s, 'D') && odh) { /* 1.#IND */
s++;
flags |= IS_NUMBER_NAN | IS_NUMBER_NOT_INT;
+ while (*s == '0') { /* 1.#IND00 */
+ s++;
+ }
} else
return 0;
}