2 Date: Tue, 15 Dec 92 14:39:56 +0100
3 From: Lennart Augustsson <augustss@cs.chalmers.se>
4 Message-Id: <9212151339.AA26402@animal.cs.chalmers.se>
5 To: partain@dcs.gla.ac.uk
6 Subject: Re: ghc 0.10 in animal:pub/incoming
10 I'd also like to contribute a small benchmark to your nofib suite, but it is
15 It compute a root to the equation x^n = 1 (i.e. mkPolar 1 (2*pi/fromInt n)),
16 and raises it to the n:th power to get 1, sums a few of these and prints the
17 result. The result of this program should be 10000. It a reasonable test
18 of how well complex numbers are handled by the compiler.
19 My ulteriour motive for suggesting this benchmark is that the next version
20 of hbc will do pretty well on this example. Since you have had the choice
21 of all the other programs I thought I'd contribute at least one :-)
26 module Main
( main
) where
29 main
= print (round (realPart (sum [f n | n
<- [1..10000]])))
31 f
:: Int -> Complex Double
32 f n
= mkPolar 1 ((2*pi)/fromInt n
) ^ n