diff options
Diffstat (limited to 'testsuite/tests/codeGen/should_run/4441.hs')
-rw-r--r-- | testsuite/tests/codeGen/should_run/4441.hs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/codeGen/should_run/4441.hs b/testsuite/tests/codeGen/should_run/4441.hs new file mode 100644 index 0000000000..ee96170af8 --- /dev/null +++ b/testsuite/tests/codeGen/should_run/4441.hs @@ -0,0 +1,20 @@ +module Main where + +import Numeric +import System.IO + +main = do + let d = read "2.0e-2" :: Double + print $ "Float Version : " ++ (fToStr $ realToFrac d) + print $ "Double Version: " ++ (dToStr d) + +double :: IO Double +double = do + x <- getLine + return $ read x + +dToStr :: Double -> String +dToStr d = show d + +fToStr :: Float -> String +fToStr = (dToStr . realToFrac) |