integer-logarithms 1.0.2.2 → 1.0.5
raw patch · 8 files changed
Files
- changelog.md +17/−1
- integer-logarithms.cabal +66/−56
- src/GHC/Integer/Logarithms/Compat.hs +3/−0
- src/Math/NumberTheory/Logarithms.hs +10/−7
- src/Math/NumberTheory/Powers/Integer.hs +1/−5
- src/Math/NumberTheory/Powers/Natural.hs +2/−6
- test-suite/Math/NumberTheory/LogarithmsTests.hs +1/−8
- test-suite/Orphans.hs +3/−0
changelog.md view
@@ -1,7 +1,23 @@+1.0.4+-----++- Drop support for GHCs prior 8.6.5+- GHC-9.12 support++1.0.3.1+-------++- GHC-9.0 support++1.0.3+-----++- Mark all modules `Trustworthy`. (deprecated modules are `Safe` for GHC-7.4+).+ 1.0.2.2 ------- -- GHC-8.6.1 compatible relase+- GHC-8.6.1 compatible release - Fix compilation when `+check-bounds` 1.0.2.1
integer-logarithms.cabal view
@@ -1,16 +1,17 @@ name: integer-logarithms-version: 1.0.2.2-cabal-version: >= 1.10+version: 1.0.5+cabal-version: >=1.10 author: Daniel Fischer-copyright: (c) 2011 Daniel Fischer+copyright:+ (c) 2011 Daniel Fischer, 2017-2020 Oleg Grenrus, Andrew Lelechenko+ license: MIT license-file: LICENSE maintainer: Oleg Grenrus <oleg.grenrus@iki.fi> build-type: Simple stability: Provisional-homepage: https://github.com/Bodigrim/integer-logarithms-bug-reports: https://github.com/Bodigrim/integer-logarithms/issues-+homepage: https://github.com/haskellari/integer-logarithms+bug-reports: https://github.com/haskellari/integer-logarithms/issues synopsis: Integer logarithms. description: "Math.NumberTheory.Logarithms" and "Math.NumberTheory.Powers.Integer"@@ -21,91 +22,100 @@ additional functions in migrated modules. category: Math, Algorithms, Number Theory- tested-with:- GHC==7.0.4,- GHC==7.2.2,- GHC==7.4.2,- GHC==7.6.3,- GHC==7.8.4,- GHC==7.10.3,- GHC==8.0.2,- GHC==8.2.2,- GHC==8.4.3,- GHC==8.6.1+ GHC ==8.6.5+ || ==8.8.4+ || ==8.10.4+ || ==9.0.2+ || ==9.2.8+ || ==9.4.8+ || ==9.6.6+ || ==9.8.4+ || ==9.10.2+ || ==9.12.2+ || ==9.14.1 -extra-source-files : readme.md changelog.md+extra-source-files:+ changelog.md+ readme.md flag integer-gmp- description: integer-gmp or integer-simple- default: True- manual: False+ description: integer-gmp or integer-simple+ default: True+ manual: False flag check-bounds- description: Replace unsafe array operations with safe ones- default: False- manual: True+ description: Replace unsafe array operations with safe ones+ default: False+ manual: True library default-language: Haskell2010- hs-source-dirs: src+ hs-source-dirs: src build-depends:- base >= 4.3 && < 4.13,- array >= 0.3 && < 0.6,- ghc-prim < 0.6- if impl(ghc >= 7.10)- cpp-options: -DBase48- else- build-depends: nats >= 1.1 && <1.2+ array >=0.5.3.0 && <0.6+ , base >=4.12.0.0 && <4.23 - if flag(integer-gmp)- build-depends:- integer-gmp < 1.1+ if !impl(ghc >=7.10)+ build-depends: nats >=1.1.2 && <1.2++ if impl(ghc >=9.0)+ build-depends: base >=4.15++ if !flag(integer-gmp)+ build-depends: invalid-cabal-flag-settings <0+ else- build-depends:- integer-simple+ build-depends: base <4.15 + if flag(integer-gmp)+ build-depends: integer-gmp <1.1++ else+ build-depends: integer-simple+ exposed-modules: Math.NumberTheory.Logarithms Math.NumberTheory.Powers.Integer Math.NumberTheory.Powers.Natural- GHC.Integer.Logarithms.Compat++ -- compat module+ exposed-modules: GHC.Integer.Logarithms.Compat other-extensions: BangPatterns CPP MagicHash - ghc-options: -O2 -Wall+ ghc-options: -O2 -Wall+ if flag(check-bounds) cpp-options: -DCheckBounds source-repository head type: git- location: https://github.com/Bodigrim/integer-logarithms+ location: https://github.com/haskellari/integer-logarithms test-suite spec- type: exitcode-stdio-1.0- hs-source-dirs: test-suite- ghc-options: -Wall- main-is: Test.hs- default-language: Haskell2010+ type: exitcode-stdio-1.0+ hs-source-dirs: test-suite+ ghc-options: -Wall+ main-is: Test.hs+ default-language: Haskell2010 other-extensions:- StandaloneDeriving FlexibleContexts FlexibleInstances GeneralizedNewtypeDeriving MultiParamTypeClasses+ StandaloneDeriving+ build-depends:- base,- integer-logarithms,- tasty >= 0.10 && < 1.2,- tasty-smallcheck >= 0.8 && < 0.9,- tasty-quickcheck >= 0.8 && < 0.11,- tasty-hunit >= 0.9 && < 0.11,- QuickCheck >= 2.10 && < 2.12,- smallcheck >= 1.1.3 && < 1.2- if !impl(ghc >= 7.10)- build-depends: nats >= 1.1 && <1.2+ base+ , integer-logarithms+ , QuickCheck >=2.16.0.0 && <2.18+ , smallcheck >=1.2 && <1.3+ , tasty >=1.4 && <1.6+ , tasty-quickcheck >=0.10 && <0.12+ , tasty-smallcheck >=0.8 && <0.9 other-modules: Math.NumberTheory.LogarithmsTests
src/GHC/Integer/Logarithms/Compat.hs view
@@ -8,6 +8,9 @@ -- -- Low level stuff for integer logarithms. {-# LANGUAGE CPP, MagicHash, UnboxedTuples #-}+#if __GLASGOW_HASKELL__ >= 702+{-# LANGUAGE Trustworthy #-}+#endif module GHC.Integer.Logarithms.Compat ( -- * Functions integerLogBase#
src/Math/NumberTheory/Logarithms.hs view
@@ -11,6 +11,7 @@ -- {-# LANGUAGE CPP #-} {-# LANGUAGE MagicHash #-}+{-# LANGUAGE Trustworthy #-} module Math.NumberTheory.Logarithms ( -- * Integer logarithms with input checks integerLogBase@@ -41,8 +42,12 @@ import Data.Array.Unboxed import Numeric.Natural +#ifdef MIN_VERSION_ghc_bignum+import qualified GHC.Num.Natural as BN+#endif+ import GHC.Integer.Logarithms.Compat-#if Base48 && defined(MIN_VERSION_integer_gmp)+#if MIN_VERSION_base(4,8,0) && defined(MIN_VERSION_integer_gmp) import GHC.Integer.GMP.Internals (Integer (..)) import GHC.Natural #endif@@ -313,15 +318,13 @@ fromNatural = fromIntegral naturalLog2# :: Natural -> Int#-#if Base48 && defined(MIN_VERSION_integer_gmp)+#ifdef MIN_VERSION_ghc_bignum+naturalLog2# n = word2Int# (BN.naturalLog2# n)+#else+#if MIN_VERSION_base(4,8,0) && defined(MIN_VERSION_integer_gmp) naturalLog2# (NatS# b) = wordLog2# b naturalLog2# (NatJ# n) = integerLog2# (Jp# n) #else naturalLog2# n = integerLog2# (toInteger n) #endif--#if __GLASGOW_HASKELL__ < 707--- The times they are a-changing. The types of primops too :(-isTrue# :: Bool -> Bool-isTrue# = id #endif
src/Math/NumberTheory/Powers/Integer.hs view
@@ -9,16 +9,12 @@ -- Potentially faster power function for 'Integer' base and 'Int' -- or 'Word' exponent. ---{-# LANGUAGE CPP #-}+{-# LANGUAGE Safe #-} module Math.NumberTheory.Powers.Integer {-# DEPRECATED "It is no faster than (^)" #-} ( integerPower , integerWordPower ) where--#if !MIN_VERSION_base(4,8,0)-import Data.Word-#endif -- | Power of an 'Integer' by the left-to-right repeated squaring algorithm. -- This needs two multiplications in each step while the right-to-left
src/Math/NumberTheory/Powers/Natural.hs view
@@ -9,18 +9,14 @@ -- Potentially faster power function for 'Natural' base and 'Int' -- or 'Word' exponent. ---{-# LANGUAGE CPP #-}+{-# LANGUAGE Safe #-} module Math.NumberTheory.Powers.Natural {-# DEPRECATED "It is no faster than (^)" #-} ( naturalPower , naturalWordPower ) where -#if !MIN_VERSION_base(4,8,0)-import Data.Word-#endif--import Numeric.Natural+import Numeric.Natural (Natural) -- | Power of an 'Natural' by the left-to-right repeated squaring algorithm. -- This needs two multiplications in each step while the right-to-left
test-suite/Math/NumberTheory/LogarithmsTests.hs view
@@ -8,8 +8,6 @@ -- Tests for Math.NumberTheory.Logarithms -- -{-# LANGUAGE CPP #-}- {-# OPTIONS_GHC -fno-warn-type-defaults #-} module Math.NumberTheory.LogarithmsTests@@ -17,11 +15,6 @@ ) where import Test.Tasty--#if MIN_VERSION_base(4,8,0)-#else-import Data.Word-#endif import Numeric.Natural import Math.NumberTheory.Logarithms@@ -68,7 +61,7 @@ naturalLog2HugeProperty :: Huge (Positive Natural) -> Bool naturalLog2HugeProperty (Huge (Positive n)) = 2 ^ l <= n && 2 ^ (l + 1) > n where- l = fromIntegral $ naturalLog2 n+ l = naturalLog2 n -- | Check that 'naturalLog10' returns the largest natural @l@ such that 10 ^ @l@ <= @n@ and 10 ^ (@l@+1) > @n@. naturalLog10Property :: Positive Natural -> Bool
test-suite/Orphans.hs view
@@ -1,12 +1,15 @@+{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Orphans () where import Numeric.Natural (Natural) import Test.QuickCheck (Arbitrary (..)) +#if !MIN_VERSION_QuickCheck(2,17,0) -- | The QuickCheck-2.10 doesn't define the Arbitrary Natural instance -- We define own instance (and not use quickcheck-instance) to break -- the cycle in tests. instance Arbitrary Natural where arbitrary = fmap (fromInteger . abs) arbitrary shrink = map (fromInteger . abs) . shrink . fromIntegral+#endif