summaryrefslogtreecommitdiff
path: root/testsuite/tests/numeric/should_run/numrun015.hs
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-03-03 15:49:14 -0500
committerBen Gamari <ben@smart-cactus.org>2017-03-03 15:49:15 -0500
commit10d28d0ababe52a705c10d450869d7a61063c4ae (patch)
treed13a9cb96556b516ced7ca6ac301e54798972dc0 /testsuite/tests/numeric/should_run/numrun015.hs
parentc1dacb8a9c18677495bbe7e41391f8ca7a573070 (diff)
downloadhaskell-10d28d0ababe52a705c10d450869d7a61063c4ae.tar.gz
testsuite: Add test for floating-point abs (numrun015)
Test Plan: Validate Reviewers: idontgetoutmuch, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3273
Diffstat (limited to 'testsuite/tests/numeric/should_run/numrun015.hs')
-rw-r--r--testsuite/tests/numeric/should_run/numrun015.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/numeric/should_run/numrun015.hs b/testsuite/tests/numeric/should_run/numrun015.hs
new file mode 100644
index 0000000000..070c5ab5bd
--- /dev/null
+++ b/testsuite/tests/numeric/should_run/numrun015.hs
@@ -0,0 +1,20 @@
+-- Test that floating-point abs works correctly
+
+absF :: Float -> Float
+absF = abs
+
+absD :: Double -> Double
+absD = abs
+
+main :: IO ()
+main = do
+ print $ absF (1 / 0)
+ print $ absD (1 / 0)
+ print $ absF 1
+ print $ absD 1
+ print $ absF (-1)
+ print $ absD (-1)
+ print $ absF (-1 / 0)
+ print $ absD (-1 / 0)
+ print $ absF (1 / 0)
+ print $ absD (1 / 0)