packages feed

integer-roots 1.0.2.0 → 1.0.3.0

raw patch · 7 files changed

+22/−27 lines, 7 filesdep −doctestdep ~basedep ~tasty-quickcheck

Dependencies removed: doctest

Dependency ranges changed: base, tasty-quickcheck

Files

Math/NumberTheory/Roots/General.hs view
@@ -23,8 +23,10 @@  #include "MachDeps.h" +import Prelude hiding (Foldable(..)) import Data.Bits (countTrailingZeros, shiftL, shiftR)-import Data.List (foldl', sortBy)+import Data.Foldable (Foldable(..))+import Data.List (sortBy) import Data.Maybe (isJust) import GHC.Exts (Int(..), Word(..), word2Int#, int2Double#, double2Int#, isTrue#, Ptr(..), indexWord16OffAddr#, (/##), (**##)) #if MIN_VERSION_base(4,16,0)
Math/NumberTheory/Roots/Squares.hs view
@@ -57,6 +57,7 @@ "integerSquareRoot'/Int"     integerSquareRoot' = isqrtInt' "integerSquareRoot'/Word"    integerSquareRoot' = isqrtWord "integerSquareRoot'/Integer" integerSquareRoot' = isqrtInteger+"integerSquareRoot'/Natural" integerSquareRoot' = fromInteger . isqrtInteger . toInteger   #-} {-# INLINE [1] integerSquareRoot' #-} integerSquareRoot' :: Integral a => a -> a
README.md view
@@ -7,14 +7,14 @@ The [integer square root](https://en.wikipedia.org/wiki/Integer_square_root) (`integerSquareRoot`) of a non-negative integer-_n_+$n$ is the greatest integer-_m_+$m$ such that-<img src="https://render.githubusercontent.com/render/math?math=m\le\sqrt{n}">.+$m\le\sqrt{n}$. Alternatively, in terms of the [floor function](https://en.wikipedia.org/wiki/Floor_and_ceiling_functions),-<img src="https://render.githubusercontent.com/render/math?math=m = \lfloor\sqrt{n}\rfloor">.+$m = \lfloor\sqrt{n}\rfloor$.  For example, @@ -57,9 +57,9 @@ The integer cube root (`integerCubeRoot`) of an integer-_n_+$n$ equals to-<img src="https://render.githubusercontent.com/render/math?math=\lfloor\sqrt[3]{n}\rfloor">.+$\lfloor\sqrt[3]{n}\rfloor$.  Again, a naive approach is to implement `integerCubeRoot` via `Double`-typed computations:@@ -88,7 +88,7 @@ In spirit of `integerSquareRoot` and `integerCubeRoot` this library covers the general case as well, providing `integerRoot :: (Integral a, Integral b) => b -> a -> a`-to compute integer _k_-th roots of arbitrary precision.+to compute integer $k$-th roots of arbitrary precision.  There is also `highestPower` routine, which tries hard to represent its input as a power with as large exponent as possible. This is a useful function
changelog.md view
@@ -1,3 +1,7 @@+# 1.0.3.0++* Add a rewrite rule for `integerSquareRoot` of `Natural`.+ # 1.0.2.0  * More fixes for big-endian architectures.
integer-roots.cabal view
@@ -1,5 +1,5 @@ name:          integer-roots-version:       1.0.2.0+version:       1.0.3.0 cabal-version: >=1.10 build-type:    Simple license:       MIT@@ -12,7 +12,7 @@ description:   Calculating integer roots and testing perfect powers of arbitrary precision. Originally part of <https://hackage.haskell.org/package/arithmoi arithmoi> package. category:      Math, Algorithms, Number Theory author:        Daniel Fischer, Andrew Lelechenko-tested-with:   GHC ==8.0.2 GHC ==8.2.2 GHC ==8.4.4 GHC ==8.6.5 GHC ==8.8.4 GHC ==8.10.7 GHC ==9.0.1 GHC ==9.2.1+tested-with:   GHC ==8.0.2 GHC ==8.2.2 GHC ==8.4.4 GHC ==8.6.5 GHC ==8.8.4 GHC ==8.10.7 GHC ==9.0.2 GHC ==9.2.8 GHC ==9.4.8 GHC ==9.6.7 GHC ==9.8.4 GHC ==9.10.2 GHC ==9.12.2 extra-source-files:   changelog.md   README.md@@ -27,7 +27,7 @@   if impl(ghc < 9.0)     build-depends: integer-gmp <1.2   else-    build-depends: ghc-bignum < 1.3+    build-depends: ghc-bignum < 1.4   exposed-modules:     Math.NumberTheory.Roots   other-modules:@@ -49,7 +49,7 @@     smallcheck >=1.2 && <1.3,     tasty >=0.10,     tasty-hunit >=0.9 && <0.11,-    tasty-quickcheck >=0.9 && <0.11,+    tasty-quickcheck >=0.9 && <0.12,     tasty-smallcheck >=0.8 && <0.9   other-modules:     Math.NumberTheory.Roots.CubesTests@@ -63,12 +63,3 @@   default-language: Haskell2010   hs-source-dirs: test-suite   ghc-options: -Wall -Widentities -Wcompat--test-suite integer-roots-doctests-  type: exitcode-stdio-1.0-  main-is: Doctest.hs-  hs-source-dirs: test-suite-  build-depends:-    base,-    doctest >= 0.8-  default-language: Haskell2010
− test-suite/Doctest.hs
@@ -1,4 +0,0 @@-import Test.DocTest--main :: IO ()-main = doctest ["Math/NumberTheory/Roots.hs"]
test-suite/Math/NumberTheory/Roots/GeneralTests.hs view
@@ -13,6 +13,7 @@   ( testSuite   ) where +import Data.Bits import Test.Tasty import Test.Tasty.HUnit import Test.Tasty.QuickCheck as QC@@ -90,9 +91,9 @@       , 3       , 2) -  , a ( -2 ^ 63 :: Int+  , a ( minBound :: Int       , -2 :: Int-      , 63)+      , fromIntegral (finiteBitSize (0 :: Int) - 1))    , a ( (2 ^ 63 - 1) ^ 21       , 2 ^ 63 - 1