diff options
author | Daniel Fischer <daniel.is.fischer@googlemail.com> | 2011-11-25 10:03:02 +0100 |
---|---|---|
committer | Daniel Fischer <daniel.is.fischer@googlemail.com> | 2011-11-25 10:03:02 +0100 |
commit | 74961f72528ee82a9d69accae53409b75fd88e52 (patch) | |
tree | ba6f465815a7ab88df0cc98198d1a2c7a9eb0477 /testsuite/tests/perf/should_run/T5237.hs | |
parent | 2f394b43f0122addd89c3c8eb138c1b372695ff1 (diff) | |
download | haskell-74961f72528ee82a9d69accae53409b75fd88e52.tar.gz |
Test for #5237
Test that the rewrite rules fire. Check allocation figures to not depend
on the order of rule firings.
Diffstat (limited to 'testsuite/tests/perf/should_run/T5237.hs')
-rw-r--r-- | testsuite/tests/perf/should_run/T5237.hs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/testsuite/tests/perf/should_run/T5237.hs b/testsuite/tests/perf/should_run/T5237.hs new file mode 100644 index 0000000000..6a12f5ecea --- /dev/null +++ b/testsuite/tests/perf/should_run/T5237.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE BangPatterns #-} +module Main (main) where + +-- Test that the rewrite rules for small exponents fire (#5237). +-- If they don't fire, this will allocate much. + +fun :: Double -> Double +fun x = go 0 1.0 + where + go !acc z + | x < z = acc + | otherwise = go (acc + 1/z^4) (z+1.0) + +main :: IO () +main = print (fun 1e7) |