compensated 0.8 → 0.8.1
raw patch · 5 files changed
+70/−18 lines, 5 filesdep +criteriondep ~basePVP ok
version bump matches the API change (PVP)
Dependencies added: criterion
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- .travis.yml +17/−9
- CHANGELOG.markdown +4/−0
- benchmarks/criterion.hs +31/−0
- compensated.cabal +11/−1
- src/Numeric/Compensated.hs +7/−8
.travis.yml view
@@ -4,9 +4,11 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci #-# version: 0.7.20191106+# version: 0.8 #+version: ~> 1.0 language: c+os: linux dist: xenial git: # whether to recursively clone submodules@@ -32,20 +34,26 @@ - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx - rm -rfv $CABALHOME/packages/head.hackage-matrix:+jobs: include: - compiler: ghc-8.8.1- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.1","cabal-install-3.0"]}}+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.1","cabal-install-3.0"]}}+ os: linux - compiler: ghc-8.6.5- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-3.0"]}}+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.0"]}}+ os: linux - compiler: ghc-8.4.4- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-3.0"]}}+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.0"]}}+ os: linux - compiler: ghc-8.2.2- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-3.0"]}}+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.2.2","cabal-install-3.0"]}}+ os: linux - compiler: ghc-8.0.2- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-3.0"]}}+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.0.2","cabal-install-3.0"]}}+ os: linux - compiler: ghc-head- addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-head","cabal-install-head"]}}+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-head","cabal-install-head"]}}+ os: linux allow_failures: - compiler: ghc-head before_install:@@ -178,5 +186,5 @@ # haddock... - ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all | color_cabal_output -# REGENDATA ("0.7.20191106",["--output=.travis.yml","--config=cabal.haskell-ci","cabal.project"])+# REGENDATA ("0.8",["--output=.travis.yml","--config=cabal.haskell-ci","cabal.project"]) # EOF
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+0.8.1 [2020.01.29]+------------------+* Add a benchmark suite.+ 0.8 [2019.11.24] ---------------- * Support building with `log-domain-0.13` by removing the `Precise` superclass
+ benchmarks/criterion.hs view
@@ -0,0 +1,31 @@+{-# LANGUAGE RankNTypes #-}+import Criterion.Main++import Numeric.Compensated++class Square a where sqr :: a -> a+instance Square Float where sqr x = x * x+instance Square Double where sqr x = x * x+instance Compensable a => Square (Compensated a) where sqr = square++group :: String -> (forall a . (Floating a, Square a) => a -> a) -> Benchmark+group name f = bgroup name+ [ bench "Float" $ whnf f (0.2 :: Float)+ , bench "Double" $ whnf f (0.2 :: Double)+ , bench "Compensated Float" $ whnf f (0.2 :: Compensated Float)+ , bench "Compensated Double" $ whnf f (0.2 :: Compensated Double)+ , bench "Overcompensated Float" $ whnf f (0.2 :: Overcompensated Float)+ , bench "Overcompensated Double" $ whnf f (0.2 :: Overcompensated Double)+ ]++main :: IO ()+main = defaultMain+ [ group "(+)" (0.1 +)+ , group "(-)" (0.1 -)+ , group "(*)" (0.1 *)+ , group "negate" $ negate+ , group "square" $ sqr+ , group "(/)" $ (0.1 /)+ , group "recip" $ recip+ , group "sqrt" $ sqrt+ ]
compensated.cabal view
@@ -1,6 +1,6 @@ name: compensated category: Numeric-version: 0.8+version: 0.8.1 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE@@ -87,3 +87,13 @@ generic-deriving, semigroups >= 0.9, simple-reflect >= 0.3.1++benchmark criterion+ type: exitcode-stdio-1.0+ main-is: criterion.hs+ ghc-options: -Wall -threaded+ hs-source-dirs: benchmarks+ build-depends:+ base,+ compensated,+ criterion >= 1.0
src/Numeric/Compensated.hs view
@@ -61,7 +61,6 @@ #endif import Control.Lens as L import Control.DeepSeq-import Control.Monad import Data.Binary as Binary import Data.Data import Data.Foldable as Foldable@@ -558,11 +557,11 @@ {-# INLINE basicUnsafeSlice #-} basicOverlaps (MV_Compensated v1) (MV_Compensated v2) = M.basicOverlaps v1 v2 {-# INLINE basicOverlaps #-}- basicUnsafeNew n = MV_Compensated `liftM` M.basicUnsafeNew n+ basicUnsafeNew n = MV_Compensated <$> M.basicUnsafeNew n {-# INLINE basicUnsafeNew #-}- basicUnsafeReplicate n m = with m $ \x y -> MV_Compensated `liftM` M.basicUnsafeReplicate n (x,y)+ basicUnsafeReplicate n m = with m $ \x y -> MV_Compensated <$> M.basicUnsafeReplicate n (x,y) {-# INLINE basicUnsafeReplicate #-}- basicUnsafeRead (MV_Compensated v) i = uncurry compensated `liftM` M.basicUnsafeRead v i+ basicUnsafeRead (MV_Compensated v) i = uncurry compensated <$> M.basicUnsafeRead v i {-# INLINE basicUnsafeRead #-} basicUnsafeWrite (MV_Compensated v) i m = with m $ \ x y -> M.basicUnsafeWrite v i (x,y) {-# INLINE basicUnsafeWrite #-}@@ -574,7 +573,7 @@ {-# INLINE basicUnsafeCopy #-} basicUnsafeMove (MV_Compensated v1) (MV_Compensated v2) = M.basicUnsafeMove v1 v2 {-# INLINE basicUnsafeMove #-}- basicUnsafeGrow (MV_Compensated v) n = MV_Compensated `liftM` M.basicUnsafeGrow v n+ basicUnsafeGrow (MV_Compensated v) n = MV_Compensated <$> M.basicUnsafeGrow v n {-# INLINE basicUnsafeGrow #-} #if MIN_VERSION_vector(0,11,0) basicInitialize (MV_Compensated v) = M.basicInitialize v@@ -582,16 +581,16 @@ #endif instance (Compensable a, Unbox a) => G.Vector U.Vector (Compensated a) where- basicUnsafeFreeze (MV_Compensated v) = V_Compensated `liftM` G.basicUnsafeFreeze v+ basicUnsafeFreeze (MV_Compensated v) = V_Compensated <$> G.basicUnsafeFreeze v {-# INLINE basicUnsafeFreeze #-}- basicUnsafeThaw (V_Compensated v) = MV_Compensated `liftM` G.basicUnsafeThaw v+ basicUnsafeThaw (V_Compensated v) = MV_Compensated <$> G.basicUnsafeThaw v {-# INLINE basicUnsafeThaw #-} basicLength (V_Compensated v) = G.basicLength v {-# INLINE basicLength #-} basicUnsafeSlice i n (V_Compensated v) = V_Compensated $ G.basicUnsafeSlice i n v {-# INLINE basicUnsafeSlice #-} basicUnsafeIndexM (V_Compensated v) i- = uncurry compensated `liftM` G.basicUnsafeIndexM v i+ = uncurry compensated <$> G.basicUnsafeIndexM v i {-# INLINE basicUnsafeIndexM #-} basicUnsafeCopy (MV_Compensated mv) (V_Compensated v) = G.basicUnsafeCopy mv v