diff --git a/test/Bench.hs b/test/Bench.hs index 0ae3856..14bd2f0 100644 --- a/test/Bench.hs +++ b/test/Bench.hs @@ -1,11 +1,23 @@ +----------------------------------------------------------------------------- +-- | +-- Copyright : (C) 2015 Anselm Jonas Scholl, (C) 2023 Julia Longtin +-- License : BSD3 +-- Maintainer : Julia Longtin +-- Stability : experimental +-- Portability : GHC-specific +-- + module Main where -import TestUtils +import Prelude (Double, Float, IO, ($), (++), concatMap, map, shows, unzip) + +import TestUtils (refDoubleDown, refDoubleToWord, refDoubleUp, refDoubleUlp, refFloatDown, refFloatToWord, refFloatUp, refFloatUlp, refWordToDouble, refWordToFloat, showW, testD, testF) + +import Data.Word (Word32, Word64) -import Data.Word -import Data.Bits.Floating +import Data.Bits.Floating (coerceToFloat, coerceToWord, nextDown, nextUp, ulp) -import Criterion.Main +import Criterion.Main (Benchmark, bench, bgroup, defaultMain, nf) mkSingleBenchmarks :: ((Float, Word32) -> [Benchmark]) -> ((Double, Word64) -> [Benchmark]) -> [Benchmark] mkSingleBenchmarks mkFTest mkDTest = concatMap mkFTest testF ++ concatMap mkDTest testD diff --git a/test/TestUtils.hs b/test/TestUtils.hs index f265e43..88dfb35 100644 --- a/test/TestUtils.hs +++ b/test/TestUtils.hs @@ -1,9 +1,21 @@ +----------------------------------------------------------------------------- +-- | +-- Copyright : (C) 2015 Anselm Jonas Scholl, (C) 2023 Julia Longtin +-- License : BSD3 +-- Maintainer : Julia Longtin +-- Stability : experimental +-- Portability : GHC-specific +-- + {-# LANGUAGE ForeignFunctionInterface #-} + module TestUtils where -import Data.Word +import Prelude (Double, Float, Integral, Show, String, (/), pi, sqrt) + +import Data.Word (Word32, Word64) -import Numeric +import Numeric (showHex) -- we do not test NaNs here because their binary representation can be changed -- without changing their value and some processors have been observed to do that.