[flang-commits] [PATCH] D124401: [flang] Accept "INFINITY" as real input

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon Apr 25 09:44:58 PDT 2022


klausler created this revision.
klausler added a reviewer: vdonaldson.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.

Both "INF" and "INFINITY" are standard.


https://reviews.llvm.org/D124401

Files:
  flang/lib/Decimal/decimal-to-binary.cpp


Index: flang/lib/Decimal/decimal-to-binary.cpp
===================================================================
--- flang/lib/Decimal/decimal-to-binary.cpp
+++ flang/lib/Decimal/decimal-to-binary.cpp
@@ -439,7 +439,13 @@
       }
       if ((!limit || limit >= q + 3) && toupper(q[0]) == 'I' &&
           toupper(q[1]) == 'N' && toupper(q[2]) == 'F') {
-        p = q + 3;
+        if ((!limit || limit >= q + 8) && toupper(q[3]) == 'I' &&
+            toupper(q[4]) == 'N' && toupper(q[5]) == 'I' &&
+            toupper(q[6]) == 'T' && toupper(q[7]) == 'Y') {
+          p = q + 8;
+        } else {
+          p = q + 3;
+        }
         return {Real{Infinity()}};
       } else {
         // Invalid input


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124401.424947.patch
Type: text/x-patch
Size: 717 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220425/1afc981a/attachment.bin>


More information about the flang-commits mailing list