log-domain 0.10 → 0.10.0.1
raw patch · 4 files changed
+17/−10 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.markdown +4/−0
- HLint.hs +1/−0
- log-domain.cabal +2/−1
- src/Numeric/Log.hs +10/−9
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+0.10.0.1+--------+* Improved the stability and portability of the `doctest` test suite+ 0.10 ---- * `(**)` is now much more accurately defined.
+ HLint.hs view
@@ -0,0 +1,1 @@+ignore "Use camelCase"
log-domain.cabal view
@@ -1,6 +1,6 @@ name: log-domain category: Numeric-version: 0.10+version: 0.10.0.1 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE@@ -25,6 +25,7 @@ AUTHORS.markdown README.markdown CHANGELOG.markdown+ HLint.hs source-repository head type: git
src/Numeric/Log.hs view
@@ -56,6 +56,8 @@ {-# ANN module "HLint: ignore Eta reduce" #-} +-- $setup+-- >>> let Exp x ~= Exp y = abs ((exp x-exp y) / exp x) < 0.01 -- | @Log@-domain @Float@ and @Double@ values. newtype Log a = Exp { ln :: a } deriving (Eq,Ord,Data,Typeable,Generic)@@ -191,18 +193,17 @@ -- | Handle subtraction. ----- >>> 3 - 1 :: Log Double--- 2.0000000000000004+-- >>> (3 - 1 :: Log Double) ~= 2+-- True -- -- >>> 1 - 3 :: Log Double -- NaN -- --- >>> 3 - 2 :: Log Float--- 1.0+-- >>> (3 - 2 :: Log Float) ~= 1+-- True -- -- >>> 1 - 3 :: Log Float -- NaN--- instance (Precise a, RealFloat a) => Num (Log a) where Exp a * Exp b@@ -320,13 +321,13 @@ -- While for small quantities the naive sum accumulates error, -- -- >>> let xs = Prelude.replicate 40000 (Exp 1e-4) :: [Log Float]--- >>> Prelude.sum xs--- 40001.3+-- >>> Prelude.sum xs ~= 4.00e4+-- True -- -- This sum gives a more accurate result, ----- >>> Numeric.Log.sum xs--- 40004.01+-- >>> Numeric.Log.sum xs ~= 4.00e4+-- True -- -- /NB:/ This does require two passes over the data. sum :: (RealFloat a, Ord a, Precise a, Foldable f) => f (Log a) -> Log a