### [project @ 2002-03-15 16:14:04 by rje]

```Extended the imaginary tests so that they can be run in slow mode by setting
mode=slow.

Some of these tests required minor changes in order to be able to run at
more than one speed. In particular, gen_regexps now only outputs the number
of chars in its output, rather than all the regular expressions. This is
to avoid the slow stdout file having to be insanely huge.

I've done a half-hearted attempt at making the speculative tests go slowly
too, but that is too incomplete and too messy to be committed just yet.```
parent 398fa58f
 ... ... @@ -2,6 +2,7 @@ Compute the digits of "e" using continued fractions. Original program due to Dale Thurston, Aug 2001 > module Main where > import System (getArgs) > type ContFrac = [Integer] ... ... @@ -38,6 +39,8 @@ Finally, we convert a continued fraction to digits by repeatedly multiplying by > e :: [Integer] > e = toDigits eContFrac > main = print (take 1000 e) > main = do > [digits] <- getArgs > print (take (read digits) e)
 ... ... @@ -4,3 +4,6 @@ include \$(TOP)/mk/boilerplate.mk include \$(TOP)/mk/target.mk FAST_OPTS = 450 NORM_OPTS = 1000 SLOW_OPTS = 1400
 ... ... @@ -2,6 +2,7 @@ Compute digits of e Due to John Hughes, Aug 2001 > module Main where > import System Here's a way to compute all the digits of e. We use the series ... ... @@ -51,4 +52,6 @@ works. > iterate (carryPropagate 2 . map (10*) . tail) \$ > 2:[1,1..] > main = print (take 2000 e) > main = do > [digits] <- getArgs > print (take (read digits) e)
 ... ... @@ -4,3 +4,6 @@ include \$(TOP)/mk/boilerplate.mk include \$(TOP)/mk/target.mk FAST_OPTS = 450 NORM_OPTS = 2000 SLOW_OPTS = 2700
 "2.7182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274274663919320030599218174135966290435729003342952605956307381323286279434907632338298807531952510190115738341879307021540891499348841675092447614606680822648001684774118537423454424371075390777449920695517027618386062613313845830007520449338265602976067371132007093287091274437470472306969772093101416928368190255151086574637721112523897844250569536967707854499699679468644549059879316368892300987931277361782154249992295763514822082698951936680331825288693984964651058209392398294887933203625094431173012381970684161403970198376793206832823764648042953118023287825098194558153017567173613320698112509961818815930416903515988885193458072738667385894228792284998920868058257492796104841984443634632449684875602336248270419786232090021609902353043699418491463140934317381436405462531520961836908887070167683964243781405927145635490613031072085103837505101157477041718986106873969655212671546889570350354021234078498193343210681701210056278802351930332247450158539047304199577770935036604169973297250886876966403555707162268447162560798826517871341951246652010305921236677194325278675398558944896970964097545918569563802363701621120477427228364896134225164450781824423529486363721417402388934412479635743702637552944483379980161254922785092577825620926226483262779333865664816277251640191059004916449982893150566047258027786318641551956532442586982946959308019152987211725563475463964479101459040905862984967912874068705048958586717479854667757573205681288459205413340539220001137863009455606881667400169842055804033637953764520304024322566135278369511778838638744396625322498506549958862342818997077332761717839280349465014345588970719425863987727547109629537415211151368350627526023264847287039207643100595841166120545297030236472549296669381151373227536450988890313602057248176585118063036442812314965507047510254465011727211555194866850800368532281831521960037356252794495158284188294787610852639813955990067376482922443752871846245780361929819713991475644882626039033814418232625150974827987779964373089970388867782271383605772978824125611907176639465070633045279546618550966661856647097113444740160704626215680717481877844371436988218559670959102596862002353718588748569652200050311734392073211390803293634479727355955277349071783793421637012050054513263835440001863239914907054797780566978533580489669062951194324730995876552368128590413832411607226029983305353708761389396391779574540161372236187893652605381558415871869255386061647798340254351284396129460352913325942794904337299085731580290958631382683291477116396337092400316894586360606458459251269946557248391865642097526850823075442545993"
 ... ... @@ -16,6 +16,8 @@ Haskell and here is the result using hbc. -} ---------------------------------------------------------- import System infix 8 ^^^ data Nat = Z | S Nat deriving (Eq,Ord, Show {-was:Text-}) ... ... @@ -36,7 +38,9 @@ int (S x) = 1 + int x x ^^^ Z = S Z x ^^^ S y = x * (x ^^^ y) main = print (int (3 ^^^ 8)) main = do [power] <- getArgs print \$ int (3 ^^^ (fromInteger \$ read power)) -- -- Timing for hbc version 0.997.2 ... ...
 ... ... @@ -2,3 +2,7 @@ TOP = ../.. include \$(TOP)/mk/boilerplate.mk include \$(TOP)/mk/target.mk FAST_OPTS = 8 NORM_OPTS = 8 SLOW_OPTS = 9
 19683
 ... ... @@ -2,11 +2,18 @@ -- !!! all the expansions of a generalised regular expression -- !!! -- -- RJE: Modified so it only outputs the number of characters in the output, -- rather that the output itself, thus avoiding having to generate such a -- huge output file to get a reasonable execution time. module Main (main) where import Char main = interact (("Enter a generator: " ++).show.expand.head.lines) main = interact (("Enter a generator: " ++).show.numchars.expand.head.lines) numchars :: [String] -> Int numchars l = sum \$ map length l expand [] = [""] expand ('<':x) = numericRule x ... ...
 [a-j][a-j][a-j][a-j][a-j][a-j][a-d]abcdefghijklmnopqrstuvwxyz
 Enter a generator: 132000000 \ No newline at end of file
This diff is collapsed.
 module Main where module Main (integrate1D, main) where import System integrate1D :: Double -> Double -> (Double->Double) -> Double integrate1D l u f = ... ... @@ -33,6 +35,8 @@ es = map (^2) (zipWith (-) rtotals itotals) etotal n = sum (take n es) -- The (analytical) result should be zero main = putStrLn (show (etotal 50000)) main = do [range] <- getArgs putStrLn \$ show \$ etotal \$ read range
 TOP = ../.. include \$(TOP)/mk/boilerplate.mk SRC_RUNTEST_OPTS += +RTS -K3m -H30m -RTS SRC_RUNTEST_OPTS += +RTS -K20m -H100m -RTS -include opts.mk include \$(TOP)/mk/target.mk FAST_OPTS = 5000 NORM_OPTS = 50000 SLOW_OPTS = 100000
 0
 ... ... @@ -7,6 +7,7 @@ module Main (main) where import Array import System -- Generation of radicals ... ... @@ -82,7 +83,9 @@ paraffins_until n = radicals = radical_generator (div n 2) main = do print [length (rads!i) | rads <- [(radical_generator 17)], i <- [0..17]] print (bcp_until 17) print (ccp_until 17) print (paraffins_until 17) [arg] <- getArgs let num = read arg print [length (rads!i) | rads <- [(radical_generator num)], i <- [0..num]] print (bcp_until num) print (ccp_until num) print (paraffins_until num)
 ... ... @@ -8,3 +8,7 @@ SRC_RUNTEST_OPTS += +RTS -H20m -RTS include \$(TOP)/mk/target.mk FAST_OPTS = 17 NORM_OPTS = 17 SLOW_OPTS = 19
 500000
 [1,1,1,2,4,8,17,39,89,211,507,1238,3057,7639,19241,48865,124906,321198,830219,2156010] [0,1,0,1,0,3,0,10,0,36,0,153,0,780,0,4005,0,22366,0] [1,0,1,1,3,2,9,8,35,39,159,202,802,1078,4347,6354,24894,38157,148284] [1,1,1,2,3,5,9,18,35,75,159,355,802,1858,4347,10359,24894,60523,148284]
 import System suCC :: Int -> Int suCC x = x + 1 ... ... @@ -10,4 +13,6 @@ the_filter (n:ns) = filter (isdivs n) ns primes :: [Int] primes = map head (iterate the_filter (iterate suCC 2)) main = print (primes !! 1500) main = do [arg] <- getArgs print \$ primes !! (read arg)
 ... ... @@ -6,3 +6,6 @@ SRCS = Main.hs include \$(TOP)/mk/target.mk FAST_OPTS = 2000 NORM_OPTS = 1500 SLOW_OPTS = 5500
 54001
 -- !!! count the number of solutions to the "n queens" problem. -- (grabbed from LML dist) main = print (nsoln 10) import System main = do [arg] <- getArgs print \$ nsoln \$ read arg nsoln nq = length (gen nq) where ... ...
 ... ... @@ -3,3 +3,8 @@ include \$(TOP)/mk/boilerplate.mk -include opts.mk include \$(TOP)/mk/target.mk SRCS = Main.hs FAST_OPTS = 10 NORM_OPTS = 10 SLOW_OPTS = 13
 73712
 -- !!! the ultra-notorious "nfib 30" does w/ Floats -- module Main (main) where import System main = print (nfib 30) main = do [arg] <- getArgs print \$ nfib \$ read arg nfib :: Double -> Double nfib n = if n <= 1 then 1 else nfib (n-1) + nfib (n-2) + 1 ... ...
 ... ... @@ -3,3 +3,6 @@ include \$(TOP)/mk/boilerplate.mk -include opts.mk include \$(TOP)/mk/target.mk FAST_OPTS = 30 NORM_OPTS = 30 SLOW_OPTS = 38
 1.26492e+08
 import System -- code of unknown provenance (partain 95/01/25) tak :: Int -> Int -> Int -> Int ... ... @@ -7,4 +11,6 @@ tak x y z = if not(y < x) then z (tak (y-1) z x) (tak (z-1) x y) main = print (shows (tak 24 16 8) "\n") main = do [xs,ys,zs] <- getArgs print (tak (read xs) (read ys) (read zs))
 ... ... @@ -3,3 +3,5 @@ include \$(TOP)/mk/boilerplate.mk -include opts.mk include \$(TOP)/mk/target.mk NORM_OPTS = 24 16 8 SLOW_OPTS = 33 17 8
 9
 "9\n" 9
 ... ... @@ -2,8 +2,12 @@ -- Colin Runciman (colin@cs.york.ac.uk); March 1996. -- See article "Lazy wheel sieves and spirals of primes" (to appear, JFP). import System data Wheel = Wheel Int [Int] primes :: [Int] primes = sieve wheels primes squares ... ... @@ -32,4 +36,6 @@ nextSize (Wheel s ns) p = n <- ns, n' <- [n+o], n'`mod`p > 0] main = print (primes!!(100000::Int)) main = do [arg] <- getArgs print (primes!!((read arg) :: Int))
 ... ... @@ -3,3 +3,5 @@ include \$(TOP)/mk/boilerplate.mk -include opts.mk include \$(TOP)/mk/target.mk NORM_OPTS = 100000 SLOW_OPTS = 230000
 3196939
 ... ... @@ -2,6 +2,8 @@ -- Colin Runciman (colin@cs.york.ac.uk); March 1996. -- See article "Lazy wheel sieves and spirals of primes" (to appear, JFP). import System primes :: [Int] primes = spiral wheels primes squares ... ... @@ -39,5 +41,7 @@ nextSize (Wheel s ms ns) p q = let n' = o+n in if n'`mod`p>0 then n':rs else rs main = print (primes!!(20000::Int)) main = do [arg] <- getArgs print (primes!!((read arg) :: Int))
 ... ... @@ -7,3 +7,6 @@ EXTRA_RUNTEST_OPTS = +RTS -M100m -RTS include \$(TOP)/mk/target.mk NORM_OPTS = 20000 SLOW_OPTS = 51000
 625199
 ... ... @@ -25,8 +25,11 @@ of all the other programs I thought I'd contribute at least one :-) module Main ( main ) where import Complex import System main = print (round (realPart (sum [f n | n <- [1..10000]]))) main = do [arg] <- getArgs print (round (realPart (sum [f n | n <- [1 .. (read arg)]]))) f :: Int -> Complex Double f n = mkPolar 1 ((2*pi)/fromIntegral n) ^ n
 ... ... @@ -2,3 +2,5 @@ TOP = ../.. include \$(TOP)/mk/boilerplate.mk include \$(TOP)/mk/target.mk NORM_OPTS = 10000 SLOW_OPTS = 80000
 80000
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!