summaryrefslogtreecommitdiff
path: root/testsuite/tests/perf/should_run/T5237.hs
blob: 6a12f5eceafbb6700b48d42c629a13fdef1b6a47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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)