scientific 0.3.2.1 → 0.3.2.2
raw patch · 3 files changed
+46/−6 lines, 3 filesdep +integer-simplePVP ok
version bump matches the API change (PVP)
Dependencies added: integer-simple
API changes (from Hackage documentation)
Files
- changelog +4/−0
- scientific.cabal +17/−3
- src/Math/NumberTheory/Logarithms.hs +25/−3
changelog view
@@ -1,3 +1,7 @@+0.3.2.2+ * Enable package to link with integer-simple instead of+ integer-gmp using the -finteger-simple cabal flag.+ 0.3.2.1 * Parameterize inclusion of the Data.ByteString.Builder.Scientific
scientific.cabal view
@@ -1,5 +1,5 @@ name: scientific-version: 0.3.2.1+version: 0.3.2.2 synopsis: Numbers represented using scientific notation description: @Data.Scientific@ provides a space efficient and arbitrary precision@@ -54,6 +54,10 @@ default: True manual: True +flag integer-simple+ description: Use the integer-simple package instead of integer-gmp+ default: False+ library exposed-modules: Data.Scientific Data.Text.Lazy.Builder.Scientific@@ -62,11 +66,17 @@ ghc-options: -Wall build-depends: base >= 4.3 && < 4.8 , ghc-prim- , integer-gmp , deepseq >= 1.3 && < 1.4 , text >= 0.8 && < 1.3 , hashable >= 1.1.2 && < 1.3 , array >= 0.1 && < 0.6++ if flag(integer-simple)+ build-depends: integer-simple+ CPP-options: -DINTEGER_SIMPLE+ else+ build-depends: integer-gmp+ hs-source-dirs: src default-language: Haskell2010 @@ -101,9 +111,13 @@ build-depends: base >= 4.3 && < 4.8 , criterion >= 0.5 && < 0.12 , ghc-prim- , integer-gmp , deepseq >= 1.3 && < 1.4 , text >= 0.8 && < 1.3 , bytestring >= 0.10 && < 0.11 , hashable >= 1.1.2 && < 1.3 , array >= 0.1 && < 0.6++ if flag(integer-simple)+ build-depends: integer-simple+ else+ build-depends: integer-gmp
src/Math/NumberTheory/Logarithms.hs view
@@ -3,15 +3,36 @@ -- | Integer logarithm, copied from Daniel Fischer's @arithmoi@ module Math.NumberTheory.Logarithms ( integerLog10' ) where -import GHC.Base+#if defined(INTEGER_SIMPLE) && __GLASGOW_HASKELL__ < 702+import GHC.Integer.Logarithms (integerLogBase#)+import GHC.Base (Int(I#)) +-- | Only defined for positive inputs!+integerLog10' :: Integer -> Int+integerLog10' m = I# (integerLogBase# 10 m)++#else+import GHC.Base ( Int(I#), Word#, Int#+ , int2Word#, eqWord#, neWord#, (-#), and#, uncheckedShiftRL#++#if __GLASGOW_HASKELL__ >= 707+ , isTrue#+#endif+ )+ #if __GLASGOW_HASKELL__ >= 702-import GHC.Integer.Logarithms+import GHC.Integer.Logarithms (integerLog2#, wordLog2#) #else #include "MachDeps.h" -import GHC.Integer.GMP.Internals+import GHC.Integer.GMP.Internals (Integer(S#, J#)) +import GHC.Base ( indexWordArray#, uncheckedIShiftL#, indexInt8Array#+ , word2Int#, ByteArray#, newByteArray#, writeInt8Array#+ , (==#), (<#), (+#), (*#)+ , unsafeFreezeByteArray#, realWorld#+ )+ #if (WORD_SIZE_IN_BITS != 32) && (WORD_SIZE_IN_BITS != 64) #error Only word sizes 32 and 64 are supported. #endif@@ -159,4 +180,5 @@ #if __GLASGOW_HASKELL__ < 707 isTrue# :: Bool -> Bool isTrue# = id+#endif #endif