packages feed

hmpfr 0.3.1 → 0.3.2

raw patch · 27 files changed

+175/−145 lines, 27 filesdep +integer-simpledep −integerdep −integer-gmpdep ~basenew-uploader

Dependencies added: integer-simple

Dependencies removed: integer, integer-gmp

Dependency ranges changed: base

Files

ChangeLog view
@@ -1,3 +1,4 @@+0.3.2: 28 Feb 2011: Adapted to work with mpfr 3.0.0, now depends on integer-simple 0.3: 23 Sep 2009: Added mutable interface and removed some modules from the export list. 0.2.2: 2 Sep 2009: Fixed a minor bug in internal handling. 0.2.1: 25 Aug 2009: Fixed a serious bug in fromInteger conversion.
LICENSE view
@@ -1,4 +1,4 @@-Copyright Aleš Bizjak 2008+Copyright Aleš Bizjak 2008, 2009, Michal Konečný 2011  All rights reserved. 
cbits/chsmpfr.c view
@@ -14,6 +14,17 @@   free (p); } +gmp_randstate_t * new_gmp_randstate() {+  gmp_randstate_t * state = (gmp_randstate_t *)malloc(sizeof(gmp_randstate_t));+  gmp_randinit_default(* state);+  return state;+}++__MPFR_DECLSPEC int mpfr_urandomb_deref_randstate _MPFR_PROTO ((mpfr_ptr dP, gmp_randstate_t * rsP))+{+  return mpfr_urandomb(dP, * rsP);+}+ int mpfr_nan_p_wrap(const mpfr_ptr p) {   return mpfr_nan_p(p); }
cbits/chsmpfr.h view
@@ -6,6 +6,10 @@  void clear (const mpfr_ptr ) ; +gmp_randstate_t * new_gmp_randstate();++__MPFR_DECLSPEC int mpfr_urandomb_deref_randstate _MPFR_PROTO ((mpfr_ptr dP, gmp_randstate_t * rsP));+ // these functions are defined as macros and so haskell ffi  // can't work with them directly 
demo/Demo.hs view
@@ -53,8 +53,23 @@                               . flip (MM.divi acc' acc') M.Up) [1..n]                        MM.unsafeFreeze acc +testRandom =+    do+    let rsP = M.newRandomStatePointer+    print $ M.urandomb rsP 1000+    print $ M.urandomb rsP 1000+    print $ M.urandomb rsP 1000+    print $ M.urandomb rsP 1000  main = do print $ s1 1000 1000           print $ s6 1000 1000           print $ e1 1000 1000           print $ e2 1000 1000+          testRandom+          putStrLn $ "exp 1 = " ++ (M.toStringExp 10000 $ M.exp M.Up 100 one)+          putStrLn $ "exp -1 = " ++ (M.toStringExp 10000 $ M.exp M.Up 100 (M.neg M.Up 100 one))+          putStrLn $ "exp 1 = " ++ (M.toStringExp 10000 $ M.exp M.Up 100 one)+          putStrLn $ "exp -1 = " ++ (M.toStringExp 10000 $ M.exp M.Up 100 (M.neg M.Up 100 one))+    +one = 1 :: M.MPFR+          
dict.txt view
@@ -163,7 +163,7 @@ mpfr_nextbelow : nextBelow mpfr_min : maxD mpfr_max : minD-mpfr_random2 : random2+mpfr_urandomb : urandomb mpfr_get_exp : getExp mpfr_set_exp : setExp mpfr_signbit : signbit
hmpfr.cabal view
@@ -1,12 +1,16 @@ name:                hmpfr-version:             0.3.1-synopsis:            Haskell binding to MPFR library-description:         Haskell binding to MPFR library. This version is compatible-                     only with 2.4.* and will not work with previous releases+version:             0.3.2+synopsis:            Haskell binding to the MPFR library+description:         Haskell binding to the MPFR library. This version is compatible+                     with MPFR 2.4.* and later and will not work with previous releases                      of the MPFR library.                      .--                     This is the first release that includes a mutable interface+                     /Since MPFR uses GMP, this library does not work correctly/+                     /with a ghc that has been compiled with integer-gmp./  +                     /When using ghc, this library will require that the ghc/+                     /is compiled  with integer-simple./+                     .+                     The library includes a mutable interface                      in addition to the pure one. These functions should have a                      lot less overhead than the pure ones.                      .@@ -15,10 +19,10 @@ license:             BSD3 license-file:        LICENSE Stability:           experimental-tested-with:         GHC == 6.10.4-author:              Aleš Bizjak-maintainer:          Aleš Bizjak <ales.bizjak0@gmail.com>-Homepage:            http://code.haskell.org/hmpfr/+tested-with:         GHC == 6.12.3+author:              Aleš Bizjak, Michal Konečný+maintainer:          Michal Konečný <mikkonecny@gmail.com>+Homepage:            http://code.google.com/p/hmpfr/  build-type:          Simple cabal-version:       >= 1.2@@ -30,10 +34,8 @@  Library   build-Depends:       base > 3 && < 5-  if impl(ghc >= 6.10) && impl(ghc < 6.12)-     build-Depends:    base >= 4, integer-  if impl(ghc >= 6.12)-     build-Depends:    integer-gmp+  if impl(ghc)+     build-Depends:    integer-simple    Other-modules:       Data.Number.MPFR.FFIhelper                        Data.Number.MPFR.Internal@@ -66,7 +68,7 @@   GHC-prof-options:    -prof -auto   hs-source-dirs:      src   include-dirs:        cbits-  includes:            chsmpfr.h mpfr.h+  includes:            mpfr.h   install-includes:    chsmpfr.h   c-sources:           cbits/chsmpfr.c 
src/Data/Number/MPFR.hs view
@@ -6,7 +6,7 @@     Copyright   :  (c) Aleš Bizjak     License     :  BSD3 -    Maintainer  :  ales.bizjak0@gmail.com+    Maintainer  :  mikkonecny@gmail.com     Stability   :  experimental     Portability :  non-portable @@ -70,9 +70,6 @@ If you need instances of numeric typeclasses import one of the  Data.Number.MPFR.Instances.* modules. -}--{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-}  module Data.Number.MPFR (          RoundMode (Near, Up, Down, Zero),
src/Data/Number/MPFR/Arithmetic.hs view
@@ -4,16 +4,13 @@     Copyright   :  (c) Aleš Bizjak     License     :  BSD3 -    Maintainer  :  ales.bizjak0@gmail.com+    Maintainer  :  mikkonecny@gmail.com     Stability   :  experimental     Portability :  non-portable   For documentation on particular functions see  <http://www.mpfr.org/mpfr-current/mpfr.html#Basic-Arithmetic-Functions>. -}--{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-}  module Data.Number.MPFR.Arithmetic      where
src/Data/Number/MPFR/Assignment.hs view
@@ -1,10 +1,11 @@+{-# LANGUAGE MagicHash, CPP #-} {-|     Module      :  Data.Number.MPFR.Assignment     Description :  wrappers for assignment functions-    Copyright   :  (c) Aleš Bizjak+    Copyright   :  (c) Aleš Bizjak, Michal Konečný     License     :  BSD3 -    Maintainer  :  ales.bizjak0@gmail.com+    Maintainer  :  mikkonecny@gmail.com     Stability   :  experimental     Portability :  non-portable @@ -13,16 +14,20 @@  documentation on particular functions. -} -{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-}-- module Data.Number.MPFR.Assignment where  import Data.Number.MPFR.Internal  import Data.Number.MPFR.Arithmetic +import Foreign.Storable++#if (__GLASGOW_HASKELL__ >= 610) && (__GLASGOW_HASKELL__ < 612)+#error "hmpfr can be compiled only with ghc 6.12 or newer with integer-simple" +#elif __GLASGOW_HASKELL__ >= 612+import GHC.Integer.Simple.Internals+#endif+ set     :: RoundMode -> Precision -> MPFR -> MPFR set r p = fst . set_ r p @@ -130,6 +135,17 @@  fromIntegerA     :: RoundMode -> Precision -> Integer -> MPFR fromIntegerA r p = stringToMPFR r p 10 . show ++bitsInInteger :: (Num a) => Integer -> a+bitsInInteger Naught = 0+bitsInInteger (Positive pos) = bitsInPositive pos+bitsInInteger (Negative pos) = bitsInPositive pos+bitsInPositive :: (Num a) => Positive -> a+bitsInPositive None = 0+bitsInPositive (Some _ rest) = +    sizeofInt + (bitsInPositive rest)+sizeofInt :: (Num a) => a +sizeofInt = fromIntegral $ sizeOf (0 :: Int)  compose             :: RoundMode -> Precision -> (Integer, Int) -> MPFR  compose r p (i, ii) = div2i r p (fromIntegerA r p i) ii
src/Data/Number/MPFR/Comparison.hs view
@@ -4,7 +4,7 @@     Copyright   :  (c) Aleš Bizjak     License     :  BSD3 -    Maintainer  :  ales.bizjak0@gmail.com+    Maintainer  :  mikkonecny@gmail.com     Stability   :  experimental     Portability :  non-portable @@ -14,9 +14,6 @@   For documentation on particular functions see   <http://www.mpfr.org/mpfr-current/mpfr.html#Comparison-Functions> -}--{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-}  module Data.Number.MPFR.Comparison where 
src/Data/Number/MPFR/Conversion.hs view
@@ -4,7 +4,7 @@     Copyright   :  (c) Aleš Bizjak     License     :  BSD3 -    Maintainer  :  ales.bizjak0@gmail.com+    Maintainer  :  mikkonecny@gmail.com     Stability   :  experimental     Portability :  non-portable @@ -12,10 +12,6 @@   See <http://www.mpfr.org/mpfr-current/mpfr.html#Conversion-Functions> for   documentation on particular functions. -}--{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-}-  module Data.Number.MPFR.Conversion where 
src/Data/Number/MPFR/FFIhelper.hsc view
@@ -19,23 +19,35 @@  import Data.Function(on)     -data RoundMode = Near | Zero | Up | Down | GMP_RND_MAX | GMP_RNDNA +data RoundMode = Near | Zero | Up | Down | MPFR_RNDNA                   deriving (Show, Read)  instance Enum RoundMode where+#if MPFR_VERSION_MAJOR == 2     fromEnum Near        = #{const GMP_RNDN}      fromEnum Zero        = #{const GMP_RNDZ}      fromEnum Up          = #{const GMP_RNDU}      fromEnum Down        = #{const GMP_RNDD} -    fromEnum GMP_RND_MAX = #{const GMP_RND_MAX}-    fromEnum GMP_RNDNA   = #{const GMP_RNDNA}+    fromEnum MPFR_RNDNA   = #{const GMP_RNDNA}          toEnum #{const GMP_RNDN}    = Near     toEnum #{const GMP_RNDZ}    = Zero     toEnum #{const GMP_RNDU}    = Up     toEnum #{const GMP_RNDD}    = Down-    toEnum #{const GMP_RND_MAX} = GMP_RND_MAX-    toEnum (#{const GMP_RNDNA}) = GMP_RNDNA+    toEnum (#{const GMP_RNDNA}) = MPFR_RNDNA+#else+    fromEnum Near        = #{const MPFR_RNDN} +    fromEnum Zero        = #{const MPFR_RNDZ} +    fromEnum Up          = #{const MPFR_RNDU} +    fromEnum Down        = #{const MPFR_RNDD} +    fromEnum MPFR_RNDNA   = #{const MPFR_RNDNA}+    +    toEnum #{const MPFR_RNDN}    = Near+    toEnum #{const MPFR_RNDZ}    = Zero+    toEnum #{const MPFR_RNDU}    = Up+    toEnum #{const MPFR_RNDD}    = Down+    toEnum (#{const MPFR_RNDNA}) = MPFR_RNDNA+#endif     toEnum i                    = error $ "RoundMode.toEnum called with illegal argument :" ++ show i   @@ -146,6 +158,14 @@ foreign import ccall unsafe "initS"         initS :: CPrecision -> IO (Ptr MPFR) +foreign import ccall unsafe "new_gmp_randstate"+        new_gmp_randstate :: IO (Ptr GmpRandState)++foreign import ccall unsafe "mpfr_urandomb_deref_randstate"+        mpfr_urandomb_deref_randstate ::  (Ptr MPFR) -> (Ptr GmpRandState) -> IO Int++type GmpRandState = ()+ -------------------- foreign import ccall unsafe "mpfr_get_prec_wrap"         mpfr_get_prec :: Ptr MPFR -> IO CPrecision @@ -656,9 +676,8 @@ foreign import ccall unsafe "mpfr_max"         mpfr_max :: Ptr MPFR -> Ptr MPFR -> Ptr MPFR -> CRoundMode -> IO CInt -foreign import ccall unsafe "mpfr_random2"-        mpfr_random2 :: Ptr MPFR -> MpSize -> Exp -> IO ()-+foreign import ccall unsafe "mpfr_urandomb"+        mpfr_urandomb :: Ptr MPFR -> Ptr GmpRandState -> IO ()  foreign import ccall unsafe "mpfr_get_exp_wrap"         mpfr_get_exp :: Ptr MPFR -> IO Exp
src/Data/Number/MPFR/Instances/Down.hs view
@@ -1,11 +1,11 @@-{-# LANGUAGE MagicHash, CPP #-}+-- {-# LANGUAGE MagicHash, CPP #-} {-|     Module      :  Data.Number.MPFR.Instances.Down     Description :  Instance declarations     Copyright   :  (c) Aleš Bizjak     License     :  BSD3 -    Maintainer  :  ales.bizjak0@gmail.com+    Maintainer  :  mikkonecny@gmail.com     Stability   :  experimental     Portability :  non-portable @@ -14,10 +14,7 @@   operands or with the precision of the operand.  -} -{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-} - module Data.Number.MPFR.Instances.Down () where @@ -35,13 +32,13 @@ import Data.Ratio  -#if (__GLASGOW_HASKELL__ >= 610) && (__GLASGOW_HASKELL__ < 612)-import GHC.Integer.Internals-#elif __GLASGOW_HASKELL__ >= 612-import GHC.Integer.GMP.Internals-#endif+-- #if (__GLASGOW_HASKELL__ >= 610) && (__GLASGOW_HASKELL__ < 612)+-- import GHC.Integer.Internals+-- #elif __GLASGOW_HASKELL__ >= 612+-- import GHC.Integer.GMP.Internals+-- #endif -import qualified GHC.Exts as E+-- import qualified GHC.Exts as E  instance Num MPFR where     d + d'        = A.add Down (maxPrec d d') d d'@@ -50,8 +47,10 @@     negate d      = A.neg Down (getPrec d) d     abs d         = A.absD Down (getPrec d) d     signum        = fromInt Down minPrec . fromMaybe (-1) .sgn-    fromInteger (S# i) = fromInt Down minPrec (E.I# i)-    fromInteger i@(J# n _) = fromIntegerA Zero (fromIntegral . abs $ E.I# n * bitsPerIntegerLimb) i +    fromInteger i = +        fromIntegerA Down (max minPrec $ 1 + bitsInInteger i) i+--    fromInteger (S# i) = fromInt Down minPrec (E.I# i)+--    fromInteger i@(J# n _) = fromIntegerA Zero (fromIntegral . abs $ E.I# n * bitsPerIntegerLimb) i   instance Real MPFR where     toRational d = n % 2 ^ e
src/Data/Number/MPFR/Instances/Near.hs view
@@ -1,11 +1,11 @@-{-# LANGUAGE MagicHash, CPP #-}+-- {-# LANGUAGE MagicHash, CPP #-} {-|     Module      :  Data.Number.MPFR.Instances.Near     Description :  Instance declarations     Copyright   :  (c) Aleš Bizjak     License     :  BSD3 -    Maintainer  :  ales.bizjak0@gmail.com+    Maintainer  :  mikkonecny@gmail.com     Stability   :  experimental     Portability :  non-portable @@ -14,10 +14,6 @@   operands or with the precision of the operand. -} -{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-}-- module Data.Number.MPFR.Instances.Near () where @@ -34,13 +30,13 @@  import Data.Ratio -#if (__GLASGOW_HASKELL__ >= 610) && (__GLASGOW_HASKELL__ < 612)-import GHC.Integer.Internals-#elif __GLASGOW_HASKELL__ >= 612-import GHC.Integer.GMP.Internals-#endif+-- #if (__GLASGOW_HASKELL__ >= 610) && (__GLASGOW_HASKELL__ < 612)+-- import GHC.Integer.Internals+-- #elif __GLASGOW_HASKELL__ >= 612+-- import GHC.Integer.GMP.Internals+-- #endif -import qualified GHC.Exts as E+-- import qualified GHC.Exts as E  instance Num MPFR where     d + d'        = A.add Near (maxPrec d d') d d'@@ -49,8 +45,10 @@     negate d      = A.neg Near (getPrec d) d     abs d         = A.absD Near (getPrec d) d     signum        = fromInt Near minPrec . fromMaybe (-1) . sgn-    fromInteger (S# i) = fromInt Near minPrec (E.I# i)-    fromInteger i@(J# n _) = fromIntegerA Zero (fromIntegral . abs $ E.I# n * bitsPerIntegerLimb) i +    fromInteger i = +        fromIntegerA Near (max minPrec $ 1 + bitsInInteger i) i+--    fromInteger (S# i) = fromInt Zero minPrec (E.I# i)+--    fromInteger i@(J# n _) = fromIntegerA Zero (fromIntegral . abs $ E.I# n * bitsPerIntegerLimb) i   instance Real MPFR where     toRational d = n % 2 ^ e
src/Data/Number/MPFR/Instances/Up.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE MagicHash, CPP #-}+-- {-# LANGUAGE MagicHash, CPP #-}  {-|     Module      :  Data.Number.MPFR.Instances.Up@@ -6,7 +6,7 @@     Copyright   :  (c) Aleš Bizjak     License     :  BSD3 -    Maintainer  :  ales.bizjak0@gmail.com+    Maintainer  :  mikkonecny@gmail.com     Stability   :  experimental     Portability :  non-portable @@ -15,10 +15,6 @@   operands or with the precision of the operand. -} -{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-}-- module Data.Number.MPFR.Instances.Up () where @@ -35,13 +31,13 @@  import Data.Ratio -#if (__GLASGOW_HASKELL__ >= 610) && (__GLASGOW_HASKELL__ < 612)-import GHC.Integer.Internals-#elif __GLASGOW_HASKELL__ >= 612-import GHC.Integer.GMP.Internals-#endif+-- #if (__GLASGOW_HASKELL__ >= 610) && (__GLASGOW_HASKELL__ < 612)+-- import GHC.Integer.Internals+-- #elif __GLASGOW_HASKELL__ >= 612+-- import GHC.Integer.GMP.Internals+-- #endif -import qualified GHC.Exts as E+-- import qualified GHC.Exts as E  instance Num MPFR where     d + d'        = A.add Up (maxPrec d d') d d'@@ -50,8 +46,10 @@     negate d      = A.neg Up (getPrec d) d     abs d         = A.absD Up (getPrec d) d     signum        = fromInt Up minPrec . fromMaybe (-1) . sgn-    fromInteger (S# i) = fromInt Up minPrec (E.I# i)-    fromInteger i@(J# n _) = fromIntegerA Zero (fromIntegral . abs $ E.I# n * bitsPerIntegerLimb) i +    fromInteger i = +        fromIntegerA Up (max minPrec $ 1 + bitsInInteger i) i+--    fromInteger (S# i) = fromInt Up minPrec (E.I# i)+--    fromInteger i@(J# n _) = fromIntegerA Zero (fromIntegral . abs $ E.I# n * bitsPerIntegerLimb) i   instance Real MPFR where     toRational d = n % 2 ^ e
src/Data/Number/MPFR/Instances/Zero.hs view
@@ -1,11 +1,11 @@-{-# LANGUAGE MagicHash, CPP #-}+-- {-# LANGUAGE MagicHash, CPP #-} {-|     Module      :  Data.Number.MPFR.Instances.Zero     Description :  Instance declarations     Copyright   :  (c) Aleš Bizjak     License     :  BSD3 -    Maintainer  :  ales.bizjak0@gmail.com+    Maintainer  :  mikkonecny@gmail.com     Stability   :  experimental     Portability :  non-portable @@ -14,10 +14,7 @@   operands or with the precision of the operand. -} -{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-} - module Data.Number.MPFR.Instances.Zero () where @@ -34,13 +31,13 @@  import Data.Ratio -#if (__GLASGOW_HASKELL__ >= 610) && (__GLASGOW_HASKELL__ < 612)-import GHC.Integer.Internals-#elif __GLASGOW_HASKELL__ >= 612-import GHC.Integer.GMP.Internals-#endif+-- #if (__GLASGOW_HASKELL__ >= 610) && (__GLASGOW_HASKELL__ < 612)+-- import GHC.Integer.Internals+-- #elif __GLASGOW_HASKELL__ >= 612+-- import GHC.Integer.GMP.Internals+-- #endif -import qualified GHC.Exts as E+-- import qualified GHC.Exts as E  instance Num MPFR where     d + d'        = A.add Zero (maxPrec d d') d d'@@ -49,8 +46,10 @@     negate d      = A.neg Zero (getPrec d) d     abs d         = A.absD Zero (getPrec d) d     signum        = fromInt Zero minPrec . fromMaybe (-1) . sgn-    fromInteger (S# i) = fromInt Zero minPrec (E.I# i)-    fromInteger i@(J# n _) = fromIntegerA Zero (fromIntegral . abs $ E.I# n * bitsPerIntegerLimb) i +    fromInteger i = +        fromIntegerA Zero (max minPrec $ 1 + bitsInInteger i) i+--    fromInteger (S# i) = fromInt Zero minPrec (E.I# i)+--    fromInteger i@(J# n _) = fromIntegerA Zero (fromIntegral . abs $ E.I# n * bitsPerIntegerLimb) i   instance Real MPFR where     toRational d = n % 2 ^ e
src/Data/Number/MPFR/Integer.hs view
@@ -4,16 +4,13 @@     Copyright   :  (c) Aleš Bizjak     License     :  BSD3 -    Maintainer  :  ales.bizjak0@gmail.com+    Maintainer  :  mikkonecny@gmail.com     Stability   :  experimental     Portability :  non-portable   For documentation on particular functions see  <http://www.mpfr.org/mpfr-chttp://www.mpfr.org/mpfr-current/mpfr.html#Integer-Related-Functions> -}-{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-}-  module Data.Number.MPFR.Integer where 
src/Data/Number/MPFR/Internal.hs view
@@ -1,5 +1,3 @@-{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-} {-# LANGUAGE BangPatterns #-}  module Data.Number.MPFR.Internal (
src/Data/Number/MPFR/Misc.hs view
@@ -4,15 +4,13 @@     Copyright   :  (c) Aleš Bizjak     License     :  BSD3 -    Maintainer  :  ales.bizjak0@gmail.com+    Maintainer  :  mikkonecny@gmail.com     Stability   :  experimental     Portability :  non-portable   For documentation on particular functions see  <http://www.mpfr.org/mpfr-current/mpfr.html#Miscellaneous-Functions>. -}-{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-}  module Data.Number.MPFR.Misc where @@ -68,14 +66,21 @@ minD        :: RoundMode -> Precision -> MPFR -> MPFR -> MPFR minD r p d1 = fst . minD_ r p d1 -random2       :: Precision -> MpSize -> Exp -> IO MPFR-random2 p m e = do ls <- mpfr_custom_get_size (fromIntegral p)-                   fp <- mallocForeignPtrBytes (fromIntegral ls)-                   alloca $ \p1 -> do-                     pokeDummy p1 fp p-                     mpfr_random2 p1 m e-                     peekP p1 fp+newRandomStatePointer :: Ptr GmpRandState+newRandomStatePointer =+    unsafePerformIO new_gmp_randstate +urandomb :: Ptr GmpRandState -> Precision -> MPFR+urandomb randStateP p =+    fst $+    unsafePerformIO $+    do+    withDummy p $ \dP ->+        do+        res <- mpfr_urandomb_deref_randstate dP randStateP+        return $ fromIntegral res++ getExp              :: MPFR -> Exp getExp (MP _ _ e _) = e  @@ -87,8 +92,8 @@                   alloca $ \p1 -> do                     pokeDummy p1 fp p                     with d $ \p2 -> do -                      mpfr_set p1 p2 ((fromIntegral . fromEnum) Near)-                      mpfr_set_exp p1 e+                      _ <- mpfr_set p1 p2 ((fromIntegral . fromEnum) Near)+                      _ <- mpfr_set_exp p1 e                       peekP p1 fp  signbit   :: MPFR -> Bool
src/Data/Number/MPFR/Mutable.hs view
@@ -4,7 +4,7 @@     Copyright   :  (c) Aleš Bizjak     License     :  BSD3 -    Maintainer  :  ales.bizjak0@gmail.com+    Maintainer  :  mikkonecny@gmail.com     Stability   :  experimental     Portability :  non-portable @@ -20,10 +20,6 @@ could be used in inner loops or in local calculations with temporary variables, helping reduce allocation overhead of the pure interface. -}--{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-}-  module Data.Number.MPFR.Mutable (      MMPFR,
src/Data/Number/MPFR/Mutable/Arithmetic.hs view
@@ -1,12 +1,10 @@-{-# INCLUDE <mpfr.h> #-} -{-# INCLUDE <chsmpfr.h> #-}  {-|     Module      :  Data.Number.MPFR.Mutable.Arithmetic     Description :  Basic arithmetic functions     Copyright   :  (c) Aleš Bizjak     License     :  BSD3 -    Maintainer  :  ales.bizjak0@gmail.com+    Maintainer  :  mikkonecny@gmail.com     Stability   :  experimental     Portability :  non-portable 
src/Data/Number/MPFR/Mutable/Integer.hs view
@@ -4,16 +4,13 @@     Copyright   :  (c) Aleš Bizjak     License     :  BSD3 -    Maintainer  :  ales.bizjak0@gmail.com+    Maintainer  :  mikkonecny@gmail.com     Stability   :  experimental     Portability :  non-portable   For documentation on particular functions see  <http://www.mpfr.org/mpfr-chttp://www.mpfr.org/mpfr-current/mpfr.html#Integer-Related-Functions> -}-{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-}-  module Data.Number.MPFR.Mutable.Integer where 
src/Data/Number/MPFR/Mutable/Internal.hs view
@@ -1,6 +1,3 @@-{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-}- module Data.Number.MPFR.Mutable.Internal (        module Data.Number.MPFR.FFIhelper,        withMutableMPFRBA,
src/Data/Number/MPFR/Mutable/Misc.hs view
@@ -4,16 +4,13 @@     Copyright   :  (c) Aleš Bizjak     License     :  BSD3 -    Maintainer  :  ales.bizjak0@gmail.com+    Maintainer  :  mikkonecny@gmail.com     Stability   :  experimental     Portability :  non-portable   For documentation on particular functions see  <http://www.mpfr.org/mpfr-current/mpfr.html#Miscellaneous-Functions>. -}-{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-}- module Data.Number.MPFR.Mutable.Misc where  import Data.Number.MPFR.Mutable.Internal
src/Data/Number/MPFR/Mutable/Special.hs view
@@ -4,15 +4,13 @@     Copyright   :  (c) Aleš Bizjak     License     :  BSD3 -    Maintainer  :  ales.bizjak0@gmail.com+    Maintainer  :  mikkonecny@gmail.com     Stability   :  experimental     Portability :  non-portable   For documentation on particular functions see  <http://www.mpfr.org/mpfr-current/mpfr.html#Special-Functions>. -}-{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-}  module Data.Number.MPFR.Mutable.Special where 
src/Data/Number/MPFR/Special.hs view
@@ -4,15 +4,13 @@     Copyright   :  (c) Aleš Bizjak     License     :  BSD3 -    Maintainer  :  ales.bizjak0@gmail.com+    Maintainer  :  mikkonecny@gmail.com     Stability   :  experimental     Portability :  non-portable   For documentation on particular functions see  <http://www.mpfr.org/mpfr-current/mpfr.html#Special-Functions>. -}-{-# INCLUDE <mpfr.h> #-}-{-# INCLUDE <chsmpfr.h> #-}  module Data.Number.MPFR.Special where