From 733293745e6cdad9c96ca04ade8f8fca8e6a11b3 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Thu, 26 Mar 2009 18:39:23 +0000 Subject: [PATCH] Added a work-around for generating infinity and NaN in the C backend --- backends/GenerateC.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backends/GenerateC.hs b/backends/GenerateC.hs index 6215e29..907f15a 100644 --- a/backends/GenerateC.hs +++ b/backends/GenerateC.hs @@ -531,7 +531,10 @@ cgenListAssign v e tell [";"] cgenLiteralRepr :: A.LiteralRepr -> A.Type -> CGen () -cgenLiteralRepr (A.RealLiteral m s) t = tell [s] >> genLitSuffix t +cgenLiteralRepr (A.RealLiteral m s) t + | "Infinity" `isPrefixOf` s = tell ["INFINITY"] + | "NaN" `isPrefixOf` s = tell ["NAN"] + | otherwise = tell [s] >> genLitSuffix t cgenLiteralRepr (A.IntLiteral m s) t = do genDecimal s genLitSuffix t