[flang-commits] [flang] b8f5cf9 - [flang] Accept "INFINITY" as real input

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Mon Apr 25 12:12:18 PDT 2022


Author: Peter Klausler
Date: 2022-04-25T12:12:10-07:00
New Revision: b8f5cf9d2c5689c2c9bf1843dad502912692c0e5

URL: https://github.com/llvm/llvm-project/commit/b8f5cf9d2c5689c2c9bf1843dad502912692c0e5
DIFF: https://github.com/llvm/llvm-project/commit/b8f5cf9d2c5689c2c9bf1843dad502912692c0e5.diff

LOG: [flang] Accept "INFINITY" as real input

Both "INF" and "INFINITY" are standard.

Differential Revision: https://reviews.llvm.org/D124401

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/flang/lib/Decimal/decimal-to-binary.cpp b/flang/lib/Decimal/decimal-to-binary.cpp
index 313788809bc13..f13f7cebb957d 100644
--- a/flang/lib/Decimal/decimal-to-binary.cpp
+++ b/flang/lib/Decimal/decimal-to-binary.cpp
@@ -439,7 +439,13 @@ BigRadixFloatingPointNumber<PREC, LOG10RADIX>::ConvertToBinary(
       }
       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


        


More information about the flang-commits mailing list