hmpfr 0.4.4 → 0.4.5
raw patch · 2 files changed
+9/−38 lines, 2 filesdep −integer-gmpdep −integer-simple
Dependencies removed: integer-gmp, integer-simple
Files
- hmpfr.cabal +7/−16
- src/Data/Number/MPFR/Assignment.hs +2/−22
hmpfr.cabal view
@@ -1,5 +1,6 @@+cabal-version: 3.0 name: hmpfr-version: 0.4.4+version: 0.4.5 synopsis: Haskell binding to the MPFR library description: Haskell binding to the MPFR library.@@ -11,18 +12,17 @@ Some simple examples of usage can be found in demo/Demo.hs. category: Data, Math-license: BSD3+license: BSD-3-Clause license-file: LICENSE Stability: experimental Tested-with:- GHC==7.10.3- GHC==8.0.2- GHC==8.2.2+ GHC==9.0.2+ GHC==9.2.5+ GHC==9.4.3 author: Aleš Bizjak, Michal Konečný maintainer: Michal Konečný <mikkonecny@gmail.com> Homepage: https://github.com/michalkonecny/hmpfr build-type: Simple-cabal-version: >= 1.6 Extra-source-files: demo/Demo.hs Data-files:@@ -34,18 +34,8 @@ type: git location: https://github.com/michalkonecny/hmpfr -flag use-integer-simple- description: Use this when compiling using a ghc that uses integer-simple instead of integer-gmp.- default: False- Library build-Depends: base >= 4.8 && < 5- if flag(use-integer-simple)- build-Depends: integer-simple- cpp-options: -DINTEGER_SIMPLE- else- build-Depends: integer-gmp >= 1.0 && < 1.1- cpp-options: -DINTEGER_GMP Exposed-modules: Data.Number.MPFR.FFIhelper@@ -82,3 +72,4 @@ c-sources: cbits/chsmpfr.c extra-libraries: mpfr+ default-language: Haskell2010
src/Data/Number/MPFR/Assignment.hs view
@@ -20,15 +20,7 @@ import Data.Number.MPFR.Arithmetic -#ifdef INTEGER_SIMPLE-import GHC.Integer.Simple.Internals-import Foreign.Storable (sizeOf)-#endif--#ifdef INTEGER_GMP---import GHC.Integer.GMP.Internals-import GHC.Float-#endif+import GHC.Num.Integer ( integerLogBase ) set :: RoundMode -> Precision -> MPFR -> MPFR set r p = fst . set_ r p@@ -140,19 +132,7 @@ bitsInInteger :: (Num a) => Integer -> a -# ifdef INTEGER_SIMPLE-bitsInInteger Naught = 0-bitsInInteger (Positive pos) = bitsInPositive pos-bitsInInteger (Negative pos) = bitsInPositive pos-bitsInPositive :: (Num a) => Positive -> a-bitsInPositive None = 0-bitsInPositive (Some _ rest) = - (8 * sizeofInt) + (bitsInPositive rest)-sizeofInt :: (Num a) => a -sizeofInt = fromIntegral $ sizeOf (0 :: Int) -- in bytes-#else-bitsInInteger = fromIntegral . GHC.Float.integerLogBase 2-#endif+bitsInInteger = fromIntegral . integerLogBase 2 compose :: RoundMode -> Precision -> (Integer, Int) -> MPFR compose r p (i, ii) = div2i r p (fromIntegerA r p i) ii