diff options
author | David Terei <davidterei@gmail.com> | 2011-07-20 11:09:03 -0700 |
---|---|---|
committer | David Terei <davidterei@gmail.com> | 2011-07-20 11:26:35 -0700 |
commit | 16514f272fb42af6e9c7674a9bd6c9dce369231f (patch) | |
tree | e4f332b45fe65e2a7a2451be5674f887b42bf199 /testsuite/tests/perf/should_run/T4321.hs | |
parent | ebd422aed41048476aa61dd4c520d43becd78682 (diff) | |
download | haskell-16514f272fb42af6e9c7674a9bd6c9dce369231f.tar.gz |
Move tests from tests/ghc-regress/* to just tests/*
Diffstat (limited to 'testsuite/tests/perf/should_run/T4321.hs')
-rw-r--r-- | testsuite/tests/perf/should_run/T4321.hs | 15 |
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) + |