From bca01968bb39a252a9771c9dd028bd7f71472361 Mon Sep 17 00:00:00 2001 From: Andreas Klebinger <klebinger.andreas@gmx.at> Date: Tue, 27 Apr 2021 13:11:15 +0200 Subject: [PATCH] Adjust integrate output for ghc-9 ghc-9 introduces a regression(?) in FP precision (See ghc ticket #19569). While this is unfortunate we want nofib to be useable with ghc 8.10 and 9.0 as far as possible. So I added an additional argument to the benchmark which controls if we output the benchmark result or not, which is off by default. This allows easy checking of the output manually without causing benchmark errors because the output differs. I've also added the benchmark to the ghc testsuite to avoid future regressions. --- imaginary/integrate/Main.hs | 12 ++++++------ imaginary/integrate/Makefile | 6 +++--- imaginary/integrate/integrate.faststdout | 1 - imaginary/integrate/integrate.slowstdout | 1 - imaginary/integrate/integrate.stdout | 3 ++- 5 files changed, 11 insertions(+), 12 deletions(-) delete mode 100644 imaginary/integrate/integrate.faststdout delete mode 100644 imaginary/integrate/integrate.slowstdout diff --git a/imaginary/integrate/Main.hs b/imaginary/integrate/Main.hs index 7bf5978f..71937009 100644 --- a/imaginary/integrate/Main.hs +++ b/imaginary/integrate/Main.hs @@ -17,8 +17,8 @@ integrate1D l u f = (f u)*0.5] integrate2D l1 u1 l2 u2 f = integrate1D l2 u2 - (\y->integrate1D l1 u1 - (\x->f x y)) + (\y->integrate1D l1 u1 + (\x->f x y)) zark u v = integrate2D 0.0 u 0.0 v (\x->(\y->x*y)) @@ -37,7 +37,7 @@ etotal n = sum (take n es) -- The (analytical) result should be zero main = do - [range] <- getArgs - putStrLn $ show $ etotal $ read range - - + [with_output,range] <- getArgs + if (read with_output) + then putStrLn $ show $ etotal $ read range + else seq (etotal $ read range) (putStrLn "Exact result hidden for lack of stability.\nPass 'True' as first argument to the benchmark if you want to view the computed output for testing purposes.") diff --git a/imaginary/integrate/Makefile b/imaginary/integrate/Makefile index c9080805..5eef93fd 100644 --- a/imaginary/integrate/Makefile +++ b/imaginary/integrate/Makefile @@ -4,6 +4,6 @@ include $(TOP)/mk/boilerplate.mk -include opts.mk include $(TOP)/mk/target.mk -FAST_OPTS = 100000 -NORM_OPTS = 1000000 -SLOW_OPTS = 5000000 +FAST_OPTS = False 100000 +NORM_OPTS = False 1000000 +SLOW_OPTS = False 5000000 diff --git a/imaginary/integrate/integrate.faststdout b/imaginary/integrate/integrate.faststdout deleted file mode 100644 index ba66466c..00000000 --- a/imaginary/integrate/integrate.faststdout +++ /dev/null @@ -1 +0,0 @@ -0.0 diff --git a/imaginary/integrate/integrate.slowstdout b/imaginary/integrate/integrate.slowstdout deleted file mode 100644 index f1d3ed05..00000000 --- a/imaginary/integrate/integrate.slowstdout +++ /dev/null @@ -1 +0,0 @@ -1.3615586841036482e34 diff --git a/imaginary/integrate/integrate.stdout b/imaginary/integrate/integrate.stdout index 73bce0e6..44158800 100644 --- a/imaginary/integrate/integrate.stdout +++ b/imaginary/integrate/integrate.stdout @@ -1 +1,2 @@ -9.093955583391733e28 +Exact result hidden for lack of stability. +Pass 'True' as first argument to the benchmark if you want to view the computed output for testing purposes. -- GitLab