hyperloglog 0.4.0.2 → 0.4.0.3
raw patch · 3 files changed
+17/−6 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.markdown +10/−0
- hyperloglog.cabal +1/−1
- src/Data/HyperLogLog/Type.hs +6/−5
CHANGELOG.markdown view
@@ -1,6 +1,16 @@+0.4.0.3+-------+* Fixed doctest issues caused by `vector` 0.11+* Unfortunately the `herbie` changes turned out to be flawed (due to issue mikeizbicki/HerbiePlugin#8). Rolling them back for now.++0.4.0.2+-------+* Fixed a haddock issue caused by the comments in the herbie code.+ 0.4.0.1 ------- * Added `vector` 0.11 support.+* Incorporated some changes suggested by the HerbiePlugin. 0.3.4 -----
hyperloglog.cabal view
@@ -1,6 +1,6 @@ name: hyperloglog category: Numeric-version: 0.4.0.2+version: 0.4.0.3 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE
src/Data/HyperLogLog/Type.hs view
@@ -91,6 +91,7 @@ -- >>> import Control.Lens -- >>> import Data.Reflection -- >>> import Data.Monoid+-- >>> import qualified Data.Vector.Unboxed as V ------------------------------------------------------------------------------ -- HyperLogLog@@ -100,8 +101,8 @@ -- -- Initialize a new counter: ----- >>> mempty :: HyperLogLog 3--- HyperLogLog {runHyperLogLog = fromList [0,0,0,0,0,0,0,0]}+-- >>> runHyperLogLog (mempty :: HyperLogLog 3) == V.fromList [0,0,0,0,0,0,0,0]+-- True -- -- Please note how you specify a counter size with the @n@ -- invocation. Sizes of up to 16 are valid, with 7 being a@@ -194,12 +195,12 @@ m' = fromIntegral (numBuckets n) numZeros = fromIntegral . V.length . V.filter (== 0) $ bs res = case raw < smallRange n of- True -- numZeros > 0 -> m' * log (m' / numZeros) -- 13.47 bits max error- | numZeros > 0 -> m' / 1 / (log m' - log numZeros) -- 6.47 bits max error+ True | numZeros > 0 -> m' * log (m' / numZeros) -- 13.47 bits max error+ -- numZeros > 0 -> m' / 1 / (log m' - log numZeros) -- 6.47 bits max error | otherwise -> raw False | raw <= interRange -> raw -- otherwise -> -1 * lim32 * log (1 - raw / lim32) -- 44 bits max error- | raw / lim32 < -1.7563532969399233e-6 -> - log (1 - (raw / lim32)) * lim32 -- 5.39 bits max error+ -- raw / lim32 < -1.7563532969399233e-6 -> - log (1 - (raw / lim32)) * lim32 -- 5.39 bits max error | otherwise -> raw + (raw / lim32) * raw raw = rawFact n * (1 / sm)