summaryrefslogtreecommitdiff
path: root/testsuite/tests/perf/should_run/T4321.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/perf/should_run/T4321.hs')
-rw-r--r--testsuite/tests/perf/should_run/T4321.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/testsuite/tests/perf/should_run/T4321.hs b/testsuite/tests/perf/should_run/T4321.hs
new file mode 100644
index 0000000000..b8a0dbc4a1
--- /dev/null
+++ b/testsuite/tests/perf/should_run/T4321.hs
@@ -0,0 +1,15 @@
+
+-- In 6.13 this stack overflowed
+
+module Main (main) where
+
+main :: IO ()
+main = let n = 1000000
+ in print $ integrate n (1 / fromIntegral n)
+
+integrate :: Int -> Double -> Double
+integrate n h = h * (sum (map area [1..n]))
+ where area :: Int -> Double
+ area i = let x = h * (fromIntegral i - 0.5)
+ in 4 / (1 + x*x)
+