This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
infnan: restore 'Infinity' since lln.t expects it.
authorJarkko Hietaniemi <jhi@iki.fi>
Tue, 27 Jan 2015 14:40:03 +0000 (09:40 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Wed, 28 Jan 2015 11:52:35 +0000 (06:52 -0500)
numeric.c
t/op/infnan.t

index e8ae895..a4f2e06 100644 (file)
--- a/numeric.c
+++ b/numeric.c
@@ -606,8 +606,18 @@ Perl_grok_infnan(pTHX_ const char** sp, const char* send)
         s++; if (s == send) return 0;
         if (isALPHA_FOLD_EQ(*s, 'F')) {
             s++;
-            while (*s == '0') { /* 1.#INF00 */
+            if (s < send && (isALPHA_FOLD_EQ(*s, 'I'))) {
+                int fail =
+                    flags | IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT | IS_NUMBER_TRAILING;
+                s++; if (s == send || isALPHA_FOLD_NE(*s, 'N')) return fail;
+                s++; if (s == send || isALPHA_FOLD_NE(*s, 'I')) return fail;
+                s++; if (s == send || isALPHA_FOLD_NE(*s, 'T')) return fail;
+                s++; if (s == send || isALPHA_FOLD_NE(*s, 'Y')) return fail;
                 s++;
+            } else if (odh) {
+                while (*s == '0') { /* 1.#INF00 */
+                    s++;
+                }
             }
             while (s < send && isSPACE(*s))
                 s++;
index bddea57..70f0a7d 100644 (file)
@@ -27,6 +27,7 @@ my $NaN;
 }
 
 my @PInf = ("Inf", "inf", "INF", "+Inf",
+            "Infinity",
             "1.#INF", "1#INF", "1.#INF00");
 my @NInf = map { "-$_" } grep { ! /^\+/ } @PInf;
 
@@ -244,7 +245,7 @@ TODO: {
 }
 
 SKIP: {
-    my @FInf = qw(Infinity Infinite Info Inf123 Infiniti Infinityz);
+    my @FInf = qw(Infinite Info Inf123 Infiniti Infinityz);
     if ($Config{usequadmath}) {
         skip "quadmath strtoflt128() accepts false infinities", scalar @FInf;
     }
@@ -455,6 +456,7 @@ cmp_ok('-1e-9999', '==', 0,     "underflow to 0 (runtime) from neg");
     my $T =
         [
          [ "inf",          0, $PInf ],
+         [ "infinity",     0, $PInf ],
          [ "infxy",        1, $PInf ],
          [ "inf34",        1, $PInf ],
          [ "1.#INF",       0, $PInf ],