-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Correctly-rounded arbitrary-precision floating-point arithmetic
--   
--   This package provides numeric instances for MPFR that use "Implicit
--   Configurations" from
--   <a>http://www.cs.rutgers.edu/~ccshan/prepose/prepose.pdf</a> to choose
--   a <a>Rounding</a> and <a>Precision</a>. For those that do not want to
--   use reflection, explicit instances are provided for common precisions
--   and for the built-in rounding modes.
--   
--   This package should work correctly with GHC 7.10.1 or later.
--   
--   <pre>
--   &gt;&gt;&gt; import Numeric.Rounded
--   
--   &gt;&gt;&gt; :set -XDataKinds
--   
--   &gt;&gt;&gt; exp pi :: Rounded TowardZero 512
--   23.140692632779269005729086367948547380266106242600211993445046409524342350690452783516971997067549219675952704801087773144428044414693835844717445879609842
--   </pre>
@package rounded
@version 0.1.0.1


-- | MPFR types.
module Numeric.MPFR.Types

-- | Version numbers.
pattern MPFR_VERSION_MAJOR :: forall a. (Eq a, Num a) => () => a
pattern MPFR_VERSION_MINOR :: forall a. (Eq a, Num a) => () => a
pattern MPFR_VERSION_PATCHLEVEL :: forall a. (Eq a, Num a) => () => a
pattern MPFR_VERSION :: forall a. (Eq a, Num a) => () => a

-- | <pre>
--   mpfr_t
--   </pre>
data MPFR
MPFR :: !MPFRPrec -> !MPFRSign -> !MPFRExp -> !Ptr MPLimb -> MPFR
[mpfrPrec] :: MPFR -> !MPFRPrec
[mpfrSign] :: MPFR -> !MPFRSign
[mpfrExp] :: MPFR -> !MPFRExp
[mpfrD] :: MPFR -> !Ptr MPLimb

-- | <pre>
--   mpfr_int
--   </pre>
newtype MPFRInt
MPFRInt :: Int32 -> MPFRInt

-- | <pre>
--   mpfr_uint
--   </pre>
newtype MPFRUInt
MPFRUInt :: Word32 -> MPFRUInt

-- | <pre>
--   mpfr_long
--   </pre>
newtype MPFRLong
MPFRLong :: Int64 -> MPFRLong

-- | <pre>
--   mpfr_ulong
--   </pre>
newtype MPFRULong
MPFRULong :: Word64 -> MPFRULong

-- | <pre>
--   mpfr_size_t
--   </pre>
newtype MPFRSize
MPFRSize :: Word64 -> MPFRSize

-- | <pre>
--   mpfr_prec_t
--   </pre>
newtype MPFRPrec
MPFRPrec :: Int64 -> MPFRPrec

-- | <pre>
--   mpfr_uprec_t
--   </pre>
newtype MPFRUPrec
MPFRUPrec :: Word64 -> MPFRUPrec
pattern MPFR_PREC_MIN :: forall a. (Eq a, Num a) => () => a
pattern MPFR_PREC_MAX :: forall a. (Eq a, Num a) => () => a

-- | <pre>
--   mpfr_sign_t
--   </pre>
newtype MPFRSign
MPFRSign :: Int32 -> MPFRSign

-- | <pre>
--   mpfr_exp_t
--   </pre>
newtype MPFRExp
MPFRExp :: Int64 -> MPFRExp

-- | <pre>
--   mpfr_uexp_t
--   </pre>
newtype MPFRUExp
MPFRUExp :: Word64 -> MPFRUExp
pattern MPFR_EMAX_DEFAULT :: forall a. (Eq a, Num a) => () => a
pattern MPFR_EMIN_DEFAULT :: forall a. (Eq a, Num a) => () => a

-- | <pre>
--   mpfr_rnd_t
--   </pre>
newtype MPFRRnd
MPFRRnd :: Int32 -> MPFRRnd

-- | round to nearest, with ties to even
pattern MPFR_RNDN :: forall a. (Eq a, Num a) => () => a

-- | round toward zero
pattern MPFR_RNDZ :: forall a. (Eq a, Num a) => () => a

-- | round toward +Inf
pattern MPFR_RNDU :: forall a. (Eq a, Num a) => () => a

-- | round toward -Inf
pattern MPFR_RNDD :: forall a. (Eq a, Num a) => () => a

-- | round away from zero
pattern MPFR_RNDA :: forall a. (Eq a, Num a) => () => a

-- | faithful rounding (not implemented yet)
pattern MPFR_RNDF :: forall a. (Eq a, Num a) => () => a

-- | round to nearest, with ties away from zero (mpfr_round) (do not use)
pattern MPFR_RNDNA :: forall a. (Eq a, Num a) => () => a

-- | <pre>
--   mpfr_kind_t
--   </pre>
newtype MPFRKind
MPFRKind :: Word32 -> MPFRKind
pattern MPFR_NAN_KIND :: forall a. (Eq a, Num a) => () => a
pattern MPFR_INF_KIND :: forall a. (Eq a, Num a) => () => a
pattern MPFR_ZERO_KIND :: forall a. (Eq a, Num a) => () => a
pattern MPFR_REGULAR_KIND :: forall a. (Eq a, Num a) => () => a
instance Foreign.Storable.Storable Numeric.MPFR.Types.MPFRKind
instance Data.Data.Data Numeric.MPFR.Types.MPFRKind
instance Data.Bits.FiniteBits Numeric.MPFR.Types.MPFRKind
instance Data.Bits.Bits Numeric.MPFR.Types.MPFRKind
instance GHC.Arr.Ix Numeric.MPFR.Types.MPFRKind
instance GHC.Real.Real Numeric.MPFR.Types.MPFRKind
instance GHC.Real.Integral Numeric.MPFR.Types.MPFRKind
instance GHC.Num.Num Numeric.MPFR.Types.MPFRKind
instance GHC.Enum.Bounded Numeric.MPFR.Types.MPFRKind
instance GHC.Enum.Enum Numeric.MPFR.Types.MPFRKind
instance GHC.Show.Show Numeric.MPFR.Types.MPFRKind
instance GHC.Read.Read Numeric.MPFR.Types.MPFRKind
instance GHC.Classes.Ord Numeric.MPFR.Types.MPFRKind
instance GHC.Classes.Eq Numeric.MPFR.Types.MPFRKind
instance Foreign.Storable.Storable Numeric.MPFR.Types.MPFRRnd
instance Data.Data.Data Numeric.MPFR.Types.MPFRRnd
instance Data.Bits.FiniteBits Numeric.MPFR.Types.MPFRRnd
instance Data.Bits.Bits Numeric.MPFR.Types.MPFRRnd
instance GHC.Arr.Ix Numeric.MPFR.Types.MPFRRnd
instance GHC.Real.Real Numeric.MPFR.Types.MPFRRnd
instance GHC.Real.Integral Numeric.MPFR.Types.MPFRRnd
instance GHC.Num.Num Numeric.MPFR.Types.MPFRRnd
instance GHC.Enum.Bounded Numeric.MPFR.Types.MPFRRnd
instance GHC.Enum.Enum Numeric.MPFR.Types.MPFRRnd
instance GHC.Show.Show Numeric.MPFR.Types.MPFRRnd
instance GHC.Read.Read Numeric.MPFR.Types.MPFRRnd
instance GHC.Classes.Ord Numeric.MPFR.Types.MPFRRnd
instance GHC.Classes.Eq Numeric.MPFR.Types.MPFRRnd
instance Foreign.Storable.Storable Numeric.MPFR.Types.MPFRUExp
instance Data.Data.Data Numeric.MPFR.Types.MPFRUExp
instance Data.Bits.FiniteBits Numeric.MPFR.Types.MPFRUExp
instance Data.Bits.Bits Numeric.MPFR.Types.MPFRUExp
instance GHC.Arr.Ix Numeric.MPFR.Types.MPFRUExp
instance GHC.Real.Real Numeric.MPFR.Types.MPFRUExp
instance GHC.Real.Integral Numeric.MPFR.Types.MPFRUExp
instance GHC.Num.Num Numeric.MPFR.Types.MPFRUExp
instance GHC.Enum.Bounded Numeric.MPFR.Types.MPFRUExp
instance GHC.Enum.Enum Numeric.MPFR.Types.MPFRUExp
instance GHC.Show.Show Numeric.MPFR.Types.MPFRUExp
instance GHC.Read.Read Numeric.MPFR.Types.MPFRUExp
instance GHC.Classes.Ord Numeric.MPFR.Types.MPFRUExp
instance GHC.Classes.Eq Numeric.MPFR.Types.MPFRUExp
instance Foreign.Storable.Storable Numeric.MPFR.Types.MPFRExp
instance Data.Data.Data Numeric.MPFR.Types.MPFRExp
instance Data.Bits.FiniteBits Numeric.MPFR.Types.MPFRExp
instance Data.Bits.Bits Numeric.MPFR.Types.MPFRExp
instance GHC.Arr.Ix Numeric.MPFR.Types.MPFRExp
instance GHC.Real.Real Numeric.MPFR.Types.MPFRExp
instance GHC.Real.Integral Numeric.MPFR.Types.MPFRExp
instance GHC.Num.Num Numeric.MPFR.Types.MPFRExp
instance GHC.Enum.Bounded Numeric.MPFR.Types.MPFRExp
instance GHC.Enum.Enum Numeric.MPFR.Types.MPFRExp
instance GHC.Show.Show Numeric.MPFR.Types.MPFRExp
instance GHC.Read.Read Numeric.MPFR.Types.MPFRExp
instance GHC.Classes.Ord Numeric.MPFR.Types.MPFRExp
instance GHC.Classes.Eq Numeric.MPFR.Types.MPFRExp
instance Foreign.Storable.Storable Numeric.MPFR.Types.MPFRSign
instance Data.Data.Data Numeric.MPFR.Types.MPFRSign
instance Data.Bits.FiniteBits Numeric.MPFR.Types.MPFRSign
instance Data.Bits.Bits Numeric.MPFR.Types.MPFRSign
instance GHC.Arr.Ix Numeric.MPFR.Types.MPFRSign
instance GHC.Real.Real Numeric.MPFR.Types.MPFRSign
instance GHC.Real.Integral Numeric.MPFR.Types.MPFRSign
instance GHC.Num.Num Numeric.MPFR.Types.MPFRSign
instance GHC.Enum.Bounded Numeric.MPFR.Types.MPFRSign
instance GHC.Enum.Enum Numeric.MPFR.Types.MPFRSign
instance GHC.Show.Show Numeric.MPFR.Types.MPFRSign
instance GHC.Read.Read Numeric.MPFR.Types.MPFRSign
instance GHC.Classes.Ord Numeric.MPFR.Types.MPFRSign
instance GHC.Classes.Eq Numeric.MPFR.Types.MPFRSign
instance Foreign.Storable.Storable Numeric.MPFR.Types.MPFRUPrec
instance Data.Data.Data Numeric.MPFR.Types.MPFRUPrec
instance Data.Bits.FiniteBits Numeric.MPFR.Types.MPFRUPrec
instance Data.Bits.Bits Numeric.MPFR.Types.MPFRUPrec
instance GHC.Arr.Ix Numeric.MPFR.Types.MPFRUPrec
instance GHC.Real.Real Numeric.MPFR.Types.MPFRUPrec
instance GHC.Real.Integral Numeric.MPFR.Types.MPFRUPrec
instance GHC.Num.Num Numeric.MPFR.Types.MPFRUPrec
instance GHC.Enum.Bounded Numeric.MPFR.Types.MPFRUPrec
instance GHC.Enum.Enum Numeric.MPFR.Types.MPFRUPrec
instance GHC.Show.Show Numeric.MPFR.Types.MPFRUPrec
instance GHC.Read.Read Numeric.MPFR.Types.MPFRUPrec
instance GHC.Classes.Ord Numeric.MPFR.Types.MPFRUPrec
instance GHC.Classes.Eq Numeric.MPFR.Types.MPFRUPrec
instance Foreign.Storable.Storable Numeric.MPFR.Types.MPFRPrec
instance Data.Data.Data Numeric.MPFR.Types.MPFRPrec
instance Data.Bits.FiniteBits Numeric.MPFR.Types.MPFRPrec
instance Data.Bits.Bits Numeric.MPFR.Types.MPFRPrec
instance GHC.Arr.Ix Numeric.MPFR.Types.MPFRPrec
instance GHC.Real.Real Numeric.MPFR.Types.MPFRPrec
instance GHC.Real.Integral Numeric.MPFR.Types.MPFRPrec
instance GHC.Num.Num Numeric.MPFR.Types.MPFRPrec
instance GHC.Enum.Bounded Numeric.MPFR.Types.MPFRPrec
instance GHC.Enum.Enum Numeric.MPFR.Types.MPFRPrec
instance GHC.Show.Show Numeric.MPFR.Types.MPFRPrec
instance GHC.Read.Read Numeric.MPFR.Types.MPFRPrec
instance GHC.Classes.Ord Numeric.MPFR.Types.MPFRPrec
instance GHC.Classes.Eq Numeric.MPFR.Types.MPFRPrec
instance Foreign.Storable.Storable Numeric.MPFR.Types.MPFRSize
instance Data.Data.Data Numeric.MPFR.Types.MPFRSize
instance Data.Bits.FiniteBits Numeric.MPFR.Types.MPFRSize
instance Data.Bits.Bits Numeric.MPFR.Types.MPFRSize
instance GHC.Arr.Ix Numeric.MPFR.Types.MPFRSize
instance GHC.Real.Real Numeric.MPFR.Types.MPFRSize
instance GHC.Real.Integral Numeric.MPFR.Types.MPFRSize
instance GHC.Num.Num Numeric.MPFR.Types.MPFRSize
instance GHC.Enum.Bounded Numeric.MPFR.Types.MPFRSize
instance GHC.Enum.Enum Numeric.MPFR.Types.MPFRSize
instance GHC.Show.Show Numeric.MPFR.Types.MPFRSize
instance GHC.Read.Read Numeric.MPFR.Types.MPFRSize
instance GHC.Classes.Ord Numeric.MPFR.Types.MPFRSize
instance GHC.Classes.Eq Numeric.MPFR.Types.MPFRSize
instance Foreign.Storable.Storable Numeric.MPFR.Types.MPFRULong
instance Data.Data.Data Numeric.MPFR.Types.MPFRULong
instance Data.Bits.FiniteBits Numeric.MPFR.Types.MPFRULong
instance Data.Bits.Bits Numeric.MPFR.Types.MPFRULong
instance GHC.Arr.Ix Numeric.MPFR.Types.MPFRULong
instance GHC.Real.Real Numeric.MPFR.Types.MPFRULong
instance GHC.Real.Integral Numeric.MPFR.Types.MPFRULong
instance GHC.Num.Num Numeric.MPFR.Types.MPFRULong
instance GHC.Enum.Bounded Numeric.MPFR.Types.MPFRULong
instance GHC.Enum.Enum Numeric.MPFR.Types.MPFRULong
instance GHC.Show.Show Numeric.MPFR.Types.MPFRULong
instance GHC.Read.Read Numeric.MPFR.Types.MPFRULong
instance GHC.Classes.Ord Numeric.MPFR.Types.MPFRULong
instance GHC.Classes.Eq Numeric.MPFR.Types.MPFRULong
instance Foreign.Storable.Storable Numeric.MPFR.Types.MPFRLong
instance Data.Data.Data Numeric.MPFR.Types.MPFRLong
instance Data.Bits.FiniteBits Numeric.MPFR.Types.MPFRLong
instance Data.Bits.Bits Numeric.MPFR.Types.MPFRLong
instance GHC.Arr.Ix Numeric.MPFR.Types.MPFRLong
instance GHC.Real.Real Numeric.MPFR.Types.MPFRLong
instance GHC.Real.Integral Numeric.MPFR.Types.MPFRLong
instance GHC.Num.Num Numeric.MPFR.Types.MPFRLong
instance GHC.Enum.Bounded Numeric.MPFR.Types.MPFRLong
instance GHC.Enum.Enum Numeric.MPFR.Types.MPFRLong
instance GHC.Show.Show Numeric.MPFR.Types.MPFRLong
instance GHC.Read.Read Numeric.MPFR.Types.MPFRLong
instance GHC.Classes.Ord Numeric.MPFR.Types.MPFRLong
instance GHC.Classes.Eq Numeric.MPFR.Types.MPFRLong
instance Foreign.Storable.Storable Numeric.MPFR.Types.MPFRUInt
instance Data.Data.Data Numeric.MPFR.Types.MPFRUInt
instance Data.Bits.FiniteBits Numeric.MPFR.Types.MPFRUInt
instance Data.Bits.Bits Numeric.MPFR.Types.MPFRUInt
instance GHC.Arr.Ix Numeric.MPFR.Types.MPFRUInt
instance GHC.Real.Real Numeric.MPFR.Types.MPFRUInt
instance GHC.Real.Integral Numeric.MPFR.Types.MPFRUInt
instance GHC.Num.Num Numeric.MPFR.Types.MPFRUInt
instance GHC.Enum.Bounded Numeric.MPFR.Types.MPFRUInt
instance GHC.Enum.Enum Numeric.MPFR.Types.MPFRUInt
instance GHC.Show.Show Numeric.MPFR.Types.MPFRUInt
instance GHC.Read.Read Numeric.MPFR.Types.MPFRUInt
instance GHC.Classes.Ord Numeric.MPFR.Types.MPFRUInt
instance GHC.Classes.Eq Numeric.MPFR.Types.MPFRUInt
instance Foreign.Storable.Storable Numeric.MPFR.Types.MPFRInt
instance Data.Data.Data Numeric.MPFR.Types.MPFRInt
instance Data.Bits.FiniteBits Numeric.MPFR.Types.MPFRInt
instance Data.Bits.Bits Numeric.MPFR.Types.MPFRInt
instance GHC.Arr.Ix Numeric.MPFR.Types.MPFRInt
instance GHC.Real.Real Numeric.MPFR.Types.MPFRInt
instance GHC.Real.Integral Numeric.MPFR.Types.MPFRInt
instance GHC.Num.Num Numeric.MPFR.Types.MPFRInt
instance GHC.Enum.Bounded Numeric.MPFR.Types.MPFRInt
instance GHC.Enum.Enum Numeric.MPFR.Types.MPFRInt
instance GHC.Show.Show Numeric.MPFR.Types.MPFRInt
instance GHC.Read.Read Numeric.MPFR.Types.MPFRInt
instance GHC.Classes.Ord Numeric.MPFR.Types.MPFRInt
instance GHC.Classes.Eq Numeric.MPFR.Types.MPFRInt
instance Foreign.Storable.Storable Numeric.MPFR.Types.MPFR


-- | This module contains FFI imports as unsafe ccalls.
module Numeric.MPFR.Raw.Unsafe
mpfr_init2 :: Ptr MPFR -> MPFRPrec -> IO ()
mpfr_clear :: Ptr MPFR -> IO ()
mpfr_sgn :: Ptr MPFR -> IO CInt
mpfr_get_d :: Ptr MPFR -> MPFRRnd -> IO Double
wrapped_mpfr_get_z :: Ptr MPZ -> Ptr MPFR -> MPFRRnd -> Ptr CInt -> IO CInt
mpfr_get_str :: Ptr CChar -> Ptr MPFRExp -> Int -> CSize -> Ptr MPFR -> MPFRRnd -> IO (Ptr CChar)
mpfr_free_str :: Ptr CChar -> IO ()
mpfr_set_z :: Ptr MPFR -> Ptr MPZ -> MPFRRnd -> IO CInt
mpfr_set_sj :: Ptr MPFR -> CIntMax -> MPFRRnd -> IO CInt
mpfr_set_q :: Ptr MPFR -> Ptr MPQ -> MPFRRnd -> IO CInt
mpfr_set_d :: Ptr MPFR -> Double -> MPFRRnd -> IO CInt
type Test = Ptr MPFR -> IO CInt
mpfr_nan_p :: Test
mpfr_inf_p :: Test
mpfr_zero_p :: Test
mpfr_signbit :: Test
wrapped_mpfr_get_z_2exp :: Ptr MPZ -> Ptr MPFR -> Ptr CInt -> IO MPFRExp
mpfr_set_z_2exp :: Ptr MPFR -> Ptr MPZ -> MPFRExp -> MPFRRnd -> IO CInt
type Constant = Ptr MPFR -> MPFRRnd -> IO CInt
mpfr_const_pi :: Constant
mpfr_const_log2 :: Constant
mpfr_const_euler :: Constant
mpfr_const_catalan :: Constant
type Unary = Ptr MPFR -> Ptr MPFR -> MPFRRnd -> IO CInt
mpfr_set :: Unary
mpfr_abs :: Unary
mpfr_neg :: Unary
mpfr_log :: Unary
mpfr_exp :: Unary
mpfr_sqrt :: Unary
mpfr_sin :: Unary
mpfr_cos :: Unary
mpfr_tan :: Unary
mpfr_asin :: Unary
mpfr_acos :: Unary
mpfr_atan :: Unary
mpfr_sinh :: Unary
mpfr_cosh :: Unary
mpfr_tanh :: Unary
mpfr_asinh :: Unary
mpfr_acosh :: Unary
mpfr_atanh :: Unary
mpfr_log1p :: Unary
mpfr_expm1 :: Unary
mpfr_rint :: Unary
type Unary' = Ptr MPFR -> Ptr MPFR -> IO CInt
mpfr_trunc :: Unary'
mpfr_ceil :: Unary'
mpfr_floor :: Unary'
type Binary = Ptr MPFR -> Ptr MPFR -> Ptr MPFR -> MPFRRnd -> IO CInt
mpfr_add :: Binary
mpfr_sub :: Binary
mpfr_mul :: Binary
mpfr_div :: Binary
mpfr_min :: Binary
mpfr_max :: Binary
mpfr_atan2 :: Binary
mpfr_modf :: Binary
type Comparison = Ptr MPFR -> Ptr MPFR -> IO CInt
mpfr_cmp :: Comparison
mpfr_equal_p :: Comparison
mpfr_lessgreater_p :: Comparison
mpfr_less_p :: Comparison
mpfr_greater_p :: Comparison
mpfr_lessequal_p :: Comparison
mpfr_greaterequal_p :: Comparison
mpfr_nextabove :: Ptr MPFR -> IO ()
mpfr_nextbelow :: Ptr MPFR -> IO ()
wrapped_mpfr_get_ld :: Ptr LongDouble -> Ptr MPFR -> MPFRRnd -> Ptr CInt -> IO CInt
wrapped_mpfr_get_ld_2exp :: Ptr LongDouble -> Ptr CLong -> Ptr MPFR -> MPFRRnd -> Ptr CInt -> IO CInt
wrapped_mpfr_set_ld :: Ptr MPFR -> Ptr LongDouble -> MPFRRnd -> IO CInt
wrapped_mpfr_cmp_ld :: Ptr MPFR -> Ptr LongDouble -> IO CInt


-- | This module contains FFI imports as safe ccalls.
module Numeric.MPFR.Raw.Safe
mpfr_init2 :: Ptr MPFR -> MPFRPrec -> IO ()
mpfr_clear :: Ptr MPFR -> IO ()
mpfr_sgn :: Ptr MPFR -> IO CInt
mpfr_get_d :: Ptr MPFR -> MPFRRnd -> IO Double
wrapped_mpfr_get_z :: Ptr MPZ -> Ptr MPFR -> MPFRRnd -> Ptr CInt -> IO CInt
mpfr_get_str :: Ptr CChar -> Ptr MPFRExp -> Int -> CSize -> Ptr MPFR -> MPFRRnd -> IO (Ptr CChar)
mpfr_free_str :: Ptr CChar -> IO ()
mpfr_set_z :: Ptr MPFR -> Ptr MPZ -> MPFRRnd -> IO CInt
mpfr_set_sj :: Ptr MPFR -> CIntMax -> MPFRRnd -> IO CInt
mpfr_set_q :: Ptr MPFR -> Ptr MPQ -> MPFRRnd -> IO CInt
mpfr_set_d :: Ptr MPFR -> Double -> MPFRRnd -> IO CInt
type Test = Ptr MPFR -> IO CInt
mpfr_nan_p :: Test
mpfr_inf_p :: Test
mpfr_zero_p :: Test
mpfr_signbit :: Test
wrapped_mpfr_get_z_2exp :: Ptr MPZ -> Ptr MPFR -> Ptr CInt -> IO MPFRExp
mpfr_set_z_2exp :: Ptr MPFR -> Ptr MPZ -> MPFRExp -> MPFRRnd -> IO CInt
type Constant = Ptr MPFR -> MPFRRnd -> IO CInt
mpfr_const_pi :: Constant
mpfr_const_log2 :: Constant
mpfr_const_euler :: Constant
mpfr_const_catalan :: Constant
type Unary = Ptr MPFR -> Ptr MPFR -> MPFRRnd -> IO CInt
mpfr_set :: Unary
mpfr_abs :: Unary
mpfr_neg :: Unary
mpfr_log :: Unary
mpfr_exp :: Unary
mpfr_sqrt :: Unary
mpfr_sin :: Unary
mpfr_cos :: Unary
mpfr_tan :: Unary
mpfr_asin :: Unary
mpfr_acos :: Unary
mpfr_atan :: Unary
mpfr_sinh :: Unary
mpfr_cosh :: Unary
mpfr_tanh :: Unary
mpfr_asinh :: Unary
mpfr_acosh :: Unary
mpfr_atanh :: Unary
mpfr_log1p :: Unary
mpfr_expm1 :: Unary
mpfr_rint :: Unary
type Unary' = Ptr MPFR -> Ptr MPFR -> IO CInt
mpfr_trunc :: Unary'
mpfr_ceil :: Unary'
mpfr_floor :: Unary'
type Binary = Ptr MPFR -> Ptr MPFR -> Ptr MPFR -> MPFRRnd -> IO CInt
mpfr_add :: Binary
mpfr_sub :: Binary
mpfr_mul :: Binary
mpfr_div :: Binary
mpfr_min :: Binary
mpfr_max :: Binary
mpfr_atan2 :: Binary
mpfr_modf :: Binary
type Comparison = Ptr MPFR -> Ptr MPFR -> IO CInt
mpfr_cmp :: Comparison
mpfr_equal_p :: Comparison
mpfr_lessgreater_p :: Comparison
mpfr_less_p :: Comparison
mpfr_greater_p :: Comparison
mpfr_lessequal_p :: Comparison
mpfr_greaterequal_p :: Comparison
mpfr_nextabove :: Ptr MPFR -> IO ()
mpfr_nextbelow :: Ptr MPFR -> IO ()
wrapped_mpfr_get_ld :: Ptr LongDouble -> Ptr MPFR -> MPFRRnd -> Ptr CInt -> IO CInt
wrapped_mpfr_get_ld_2exp :: Ptr LongDouble -> Ptr CLong -> Ptr MPFR -> MPFRRnd -> Ptr CInt -> IO CInt
wrapped_mpfr_set_ld :: Ptr MPFR -> Ptr LongDouble -> MPFRRnd -> IO CInt
wrapped_mpfr_cmp_ld :: Ptr MPFR -> Ptr LongDouble -> IO CInt


-- | This module contains FFI imports. In a future release they may switch
--   at runtime between safe and unsafe calls depending on cost estimates,
--   but for now thie module simply re-exports <a>Safe</a>.
--   
--   Note: beware issues with the GHC threaded runtime if you need the MPFR
--   status flags (which use OS thread local storage aka TLS). Even if you
--   use <a>forkOS</a> to create a bound thread whose FFI will all be done
--   by the same OS thread, sparks created with <a>par</a> may run on a
--   different OS thread and lead to unpredictable behaviour.
module Numeric.MPFR.Raw


module Numeric.Rounded

-- | A properly rounded floating-point number with a given rounding mode
--   and precision.
--   
--   You can <a>coerce</a> to change rounding modes, but not precision.
data Rounded (r :: RoundingMode) p

-- | Construct a properly rounded floating point number from an <a>Int</a>.
fromInt :: (Rounding r, Precision p) => Int -> Rounded r p

-- | Construct a rounded floating point number directly from a
--   <a>Double</a>.
fromDouble :: (Rounding r, Precision p) => Double -> Rounded r p

-- | Construct a rounded floating point number directly from a
--   <a>LongDouble</a>.
fromLongDouble :: (Rounding r, Precision p) => LongDouble -> Rounded r p

-- | Round to <a>Double</a> with the given rounding mode.
toDouble :: (Rounding r, Precision p) => Rounded r p -> Double

-- | Round to <a>LongDouble</a> with the given rounding mode.
toLongDouble :: (Rounding r, Precision p) => Rounded r p -> LongDouble

-- | Round to <a>Integer</a> using the specified rounding mode. Throws
--   <a>Overflow</a> if the result cannot be represented (for example,
--   infinities or NaN).
toInteger' :: (Rounding r, Precision p) => Rounded r p -> Integer

-- | Round to a different precision with the given rounding mode.
precRound :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2

-- | This class is used to specify the number of bits of precision that are
--   maintained in the significand of a properly <a>Rounded</a> floating
--   point number.
class Precision p
precision :: Precision p => proxy p -> Int
data Bytes (n :: Nat)
reifyPrecision :: Int -> (forall (p :: *). Precision p => Proxy p -> a) -> a
class Rounding (r :: RoundingMode)
rounding :: Rounding r => Proxy r -> RoundingMode
data RoundingMode

-- | currently unsupported placeholder
TowardNearestWithTiesAwayFromZero :: RoundingMode

-- | roundTiesToEven in IEEE 754-2008
TowardNearest :: RoundingMode

-- | roundTowardZero in IEEE 754-2008
TowardZero :: RoundingMode

-- | roundTowardPositive in IEEE 754-2008
TowardInf :: RoundingMode

-- | roundTowardNegative in IEEE 754-2008
TowardNegInf :: RoundingMode

-- | round away from zero
AwayFromZero :: RoundingMode

-- | currently unsupported placeholder
Faithfully :: RoundingMode
reifyRounding :: RoundingMode -> (forall s. Rounding s => Proxy s -> r) -> r

-- | Natural logarithm of 2
kLog2 :: (Rounding r, Precision p) => Rounded r p

-- | <ol>
--   <li>577...</li>
--   </ol>
kEuler :: (Rounding r, Precision p) => Rounded r p

-- | <ol>
--   <li>915...</li>
--   </ol>
kCatalan :: (Rounding r, Precision p) => Rounded r p
(.+.) :: Rounding r => Rounded r p -> Rounded r p -> Rounded r p
infixl 6 .+.
(.-.) :: Rounding r => Rounded r p -> Rounded r p -> Rounded r p
infixl 6 .-.
(.*.) :: Rounding r => Rounded r p -> Rounded r p -> Rounded r p
infixl 7 .*.
abs' :: Rounded r p -> Rounded r p
negate' :: Rounded r p -> Rounded r p
decodeFloat' :: Rounded r p -> (Integer, Int)
succUlp :: Rounded r p -> Rounded r p
predUlp :: Rounded r p -> Rounded r p
(!+!) :: (Rounding r, Precision p1, Precision p2, Precision p3) => Rounded r p1 -> Rounded r p2 -> Rounded r p3
infixl 6 !+!
(!-!) :: (Rounding r, Precision p1, Precision p2, Precision p3) => Rounded r p1 -> Rounded r p2 -> Rounded r p3
infixl 6 !-!
(!*!) :: (Rounding r, Precision p1, Precision p2, Precision p3) => Rounded r p1 -> Rounded r p2 -> Rounded r p3
infixl 7 !*!
(!/!) :: (Rounding r, Precision p1, Precision p2, Precision p3) => Rounded r p1 -> Rounded r p2 -> Rounded r p3
infixl 7 !/!
abs_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
negate_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
compare_ :: (Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2 -> Ordering
(!==!) :: (Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2 -> Bool
infix 4 !==!
(!/=!) :: (Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2 -> Bool
infix 4 !/=!
(!>=!) :: (Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2 -> Bool
infix 4 !>=!
(!<=!) :: (Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2 -> Bool
infix 4 !<=!
(!>!) :: (Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2 -> Bool
infix 4 !>!
(!<!) :: (Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2 -> Bool
infix 4 !<!
min_ :: (Rounding r, Precision p1, Precision p2, Precision p3) => Rounded r p1 -> Rounded r p2 -> Rounded r p3
max_ :: (Rounding r, Precision p1, Precision p2, Precision p3) => Rounded r p1 -> Rounded r p2 -> Rounded r p3
sqrt_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
exp_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
expm1_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
log_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
log1p_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
sin_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
cos_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
tan_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
asin_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
acos_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
atan_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
atan2_ :: (Rounding r, Precision p1, Precision p2, Precision p3) => Rounded r p1 -> Rounded r p2 -> Rounded r p3
sinh_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
cosh_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
tanh_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
asinh_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
acosh_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
atanh_ :: (Rounding r, Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
truncate_ :: (Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
round_ :: (Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
ceiling_ :: (Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2
floor_ :: (Precision p1, Precision p2) => Rounded r p1 -> Rounded r p2

-- | Use a value as a <i>constant</i> <tt>mpfr_t</tt> (attempts to modify
--   it may explode, changing the precision will explode).
withInRounded :: Rounded r p -> (Ptr MPFR -> IO a) -> IO a

-- | Allocates and initializes a new <tt>mpfr_t</tt> to the value. If the
--   precision matches after the action then it is peeked and returned.
--   Otherwise you get <a>Nothing</a>.
withInOutRounded :: Precision p => Rounded r p -> (Ptr MPFR -> IO a) -> IO (Maybe (Rounded r p), a)

-- | Allocates and initializes a new <tt>mpfr_t</tt> to the value. If the
--   precision matches after the action then it is peeked and returned.
--   Otherwise you get <a>Nothing</a>. The result ot the action is ignored.
withInOutRounded_ :: Precision p => Rounded r p -> (Ptr MPFR -> IO a) -> IO (Maybe (Rounded r p))

-- | Allocates and initializes a new <tt>mpfr_t</tt>, if the precision
--   matches after the action then it is peeked and returned. Otherwise you
--   get <a>Nothing</a>.
withOutRounded :: Precision p => (Ptr MPFR -> IO a) -> IO (Maybe (Rounded r p), a)

-- | Allocates and initializes a new <tt>mpfr_t</tt>, if the precision
--   matches after the action then it is peeked and returned. Otherwise you
--   get <a>Nothing</a>. The result of the action is ignored.
withOutRounded_ :: Precision p => (Ptr MPFR -> IO a) -> IO (Maybe (Rounded r p))

-- | Like <a>withOutRounded</a> but with the limbs allocated by GHC, which
--   should be slightly faster. However, it will crash if MPFR tries to
--   reallocate the limbs, so the action must not try to change the
--   precision or clear it, etc.
unsafeWithOutRounded :: Precision p => (Ptr MPFR -> IO a) -> IO (Maybe (Rounded r p), a)

-- | Like <a>withOutRounded_</a> but with the limbs allocated by GHC, which
--   should be slightly faster. However, it will crash if MPFR tries to
--   reallocate the limbs, so the action must not try to change the
--   precision or clear it, etc.
unsafeWithOutRounded_ :: Precision p => (Ptr MPFR -> IO a) -> IO (Maybe (Rounded r p))

-- | Peek an <tt>mpfr_t</tt> at its actual precision, reified.
peekRounded :: Rounding r => Ptr MPFR -> (forall (p :: *). Precision p => Rounded r p -> IO a) -> IO a

module Numeric.Rounded.Interval
data Interval p
I :: Rounded TowardNegInf p -> Rounded TowardInf p -> Interval p
Empty :: Interval p
fmod :: RealFrac a => a -> a -> a

-- | lift a monotone increasing function over a given interval
increasing :: (forall r. Rounding r => Rounded r a -> Rounded r b) -> Interval a -> Interval b
decreasing :: (forall r. Rounding r => Rounded r a -> Rounded r b) -> Interval a -> Interval b
(...) :: Rounded TowardNegInf p -> Rounded TowardInf p -> Interval p
(+/-) :: Rounded r p -> Rounded r' p -> Interval p
infixl 6 +/-
negInfinity :: Fractional a => a
posInfinity :: Fractional a => a

-- | create a non-empty interval or fail
interval :: Rounded TowardNegInf p -> Rounded TowardInf p -> Maybe (Interval p)

-- | The whole real number line
--   
--   <pre>
--   &gt;&gt;&gt; whole
--   -Infinity ... Infinity
--   </pre>
whole :: Precision p => Interval p

-- | An empty interval
--   
--   <pre>
--   &gt;&gt;&gt; empty
--   Empty
--   </pre>
empty :: Interval p

-- | Check if an interval is empty
--   
--   <pre>
--   &gt;&gt;&gt; null (1 ... 5)
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; null (1 ... 1)
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; null empty
--   True
--   </pre>
null :: Interval p -> Bool

-- | The infimum (lower bound) of an interval
--   
--   <pre>
--   &gt;&gt;&gt; inf (1.0 ... 20.0)
--   1.0
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; inf empty
--   *** Exception: empty interval
--   </pre>
inf :: Interval p -> Rounded TowardNegInf p

-- | The supremum (upper bound) of an interval
--   
--   <pre>
--   &gt;&gt;&gt; sup (1.0 ... 20.0)
--   20.0
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; sup empty
--   *** Exception: empty interval
--   </pre>
sup :: Interval p -> Rounded TowardInf p

-- | Is the interval a singleton point? N.B. This is fairly fragile and
--   likely will not hold after even a few operations that only involve
--   singletons
--   
--   <pre>
--   &gt;&gt;&gt; singular (singleton 1)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; singular (1.0 ... 20.0)
--   False
--   </pre>
singular :: Interval p -> Bool

-- | Calculate the width of an interval.
--   
--   <pre>
--   &gt;&gt;&gt; width (1 ... 20)
--   19 ... 19
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; width (singleton 1)
--   0 ... 0
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; width empty
--   0 ... 0
--   </pre>
width :: Precision p => Interval p -> Rounded TowardInf p

-- | Magnitude
--   
--   <pre>
--   &gt;&gt;&gt; magnitude (1 ... 20)
--   20
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; magnitude (-20 ... 10)
--   20
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; magnitude (singleton 5)
--   5
--   </pre>
--   
--   throws <tt>EmptyInterval</tt> if the interval is empty.
--   
--   <pre>
--   &gt;&gt;&gt; magnitude empty
--   *** Exception: empty interval
--   </pre>
magnitude :: Precision p => Interval p -> Rounded TowardInf p

-- | "mignitude"
--   
--   <pre>
--   &gt;&gt;&gt; mignitude (1 ... 20)
--   1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; mignitude (-20 ... 10)
--   0
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; mignitude (singleton 5)
--   5
--   </pre>
--   
--   throws <tt>EmptyInterval</tt> if the interval is empty.
--   
--   <pre>
--   &gt;&gt;&gt; mignitude empty
--   *** Exception: empty interval
--   </pre>
mignitude :: Precision p => Interval p -> Rounded TowardNegInf p

-- | Construct a symmetric interval.
--   
--   <pre>
--   &gt;&gt;&gt; symmetric 3
--   -3 ... 3
--   </pre>
symmetric :: Rounded TowardInf p -> Interval p

-- | Hausdorff distance between intervals.
--   
--   <pre>
--   &gt;&gt;&gt; distance (1 ... 7) (6 ... 10)
--   0
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; distance (1 ... 7) (15 ... 24)
--   8
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; distance (1 ... 7) (-10 ... -2)
--   3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; distance Empty (1 ... 1)
--   *** Exception: empty interval
--   </pre>
distance :: Precision p => Interval p -> Interval p -> Rounded TowardNegInf p

-- | Inflate an interval by enlarging it at both ends.
--   
--   <pre>
--   &gt;&gt;&gt; inflate 3 (-1 ... 7)
--   -4 ... 10
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; inflate (-2) (0 ... 4)
--   -2 ... 6
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; inflate 1 empty
--   Empty
--   </pre>
inflate :: Precision p => Rounded TowardInf p -> Interval p -> Interval p

-- | For all <tt>x</tt> in <tt>X</tt>, <tt>y</tt> in <tt>Y</tt>. <tt>x
--   <a>&lt;</a> y</tt>
--   
--   <pre>
--   &gt;&gt;&gt; (5 ... 10 :: Interval Double) &lt;! (20 ... 30 :: Interval Double)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (5 ... 10 :: Interval Double) &lt;! (10 ... 30 :: Interval Double)
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (20 ... 30 :: Interval Double) &lt;! (5 ... 10 :: Interval Double)
--   False
--   </pre>
(<!) :: Precision p => Interval p -> Interval p -> Bool

-- | For all <tt>x</tt> in <tt>X</tt>, <tt>y</tt> in <tt>Y</tt>. <tt>x
--   <a>&lt;=</a> y</tt>
--   
--   <pre>
--   &gt;&gt;&gt; (5 ... 10 :: Interval Double) &lt;=! (20 ... 30 :: Interval Double)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (5 ... 10 :: Interval Double) &lt;=! (10 ... 30 :: Interval Double)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (20 ... 30 :: Interval Double) &lt;=! (5 ... 10 :: Interval Double)
--   False
--   </pre>
(<=!) :: Precision p => Interval p -> Interval p -> Bool

-- | For all <tt>x</tt> in <tt>X</tt>, <tt>y</tt> in <tt>Y</tt>. <tt>x
--   <a>==</a> y</tt>
--   
--   Only singleton intervals or empty intervals can return true
--   
--   <pre>
--   &gt;&gt;&gt; (singleton 5 :: Interval Double) ==! (singleton 5 :: Interval Double)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (5 ... 10 :: Interval Double) ==! (5 ... 10 :: Interval Double)
--   False
--   </pre>
(==!) :: Interval p -> Interval p -> Bool

-- | For all <tt>x</tt> in <tt>X</tt>, <tt>y</tt> in <tt>Y</tt>. <tt>x
--   <a>/=</a> y</tt>
--   
--   <pre>
--   &gt;&gt;&gt; (5 ... 15 :: Interval Double) /=! (20 ... 40 :: Interval Double)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (5 ... 15 :: Interval Double) /=! (15 ... 40 :: Interval Double)
--   False
--   </pre>
(/=!) :: Interval p -> Interval p -> Bool

-- | For all <tt>x</tt> in <tt>X</tt>, <tt>y</tt> in <tt>Y</tt>. <tt>x
--   <a>&gt;</a> y</tt>
--   
--   <pre>
--   &gt;&gt;&gt; (20 ... 40 :: Interval Double) &gt;! (10 ... 19 :: Interval Double)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (5 ... 20 :: Interval Double) &gt;! (15 ... 40 :: Interval Double)
--   False
--   </pre>
(>!) :: Precision p => Interval p -> Interval p -> Bool

-- | For all <tt>x</tt> in <tt>X</tt>, <tt>y</tt> in <tt>Y</tt>. <tt>x
--   <a>&gt;=</a> y</tt>
--   
--   <pre>
--   &gt;&gt;&gt; (20 ... 40 :: Interval Double) &gt;=! (10 ... 20 :: Interval Double)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (5 ... 20 :: Interval Double) &gt;=! (15 ... 40 :: Interval Double)
--   False
--   </pre>
(>=!) :: Precision p => Interval p -> Interval p -> Bool

-- | Determine if a point is in the interval.
--   
--   <pre>
--   &gt;&gt;&gt; elem 3.2 (1 ... 5)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; elem 5 (1 ... 5)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; elem 1 (1 ... 5)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; elem 8 (1 ... 5)
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; elem 5 empty
--   False
--   </pre>
elem :: Rounded TowardZero p -> Interval p -> Bool

-- | Determine if a point is not included in the interval
--   
--   <pre>
--   &gt;&gt;&gt; notElem 8 (1.0 ... 5.0)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; notElem 1.4 (1.0 ... 5.0)
--   False
--   </pre>
--   
--   And of course, nothing is a member of the empty interval.
--   
--   <pre>
--   &gt;&gt;&gt; notElem 5 empty
--   True
--   </pre>
notElem :: Rounded TowardZero p -> Interval p -> Bool

-- | For all <tt>x</tt> in <tt>X</tt>, <tt>y</tt> in <tt>Y</tt>. <tt>x
--   <tt>op</tt> y</tt>
certainly :: Precision p => (forall b. Ord b => b -> b -> Bool) -> Interval p -> Interval p -> Bool

-- | Does there exist an <tt>x</tt> in <tt>X</tt>, <tt>y</tt> in <tt>Y</tt>
--   such that <tt>x <a>&lt;</a> y</tt>?
(<?) :: Precision p => Interval p -> Interval p -> Bool

-- | Does there exist an <tt>x</tt> in <tt>X</tt>, <tt>y</tt> in <tt>Y</tt>
--   such that <tt>x <a>&lt;=</a> y</tt>?
(<=?) :: Precision p => Interval p -> Interval p -> Bool

-- | Does there exist an <tt>x</tt> in <tt>X</tt>, <tt>y</tt> in <tt>Y</tt>
--   such that <tt>x <a>==</a> y</tt>?
(==?) :: Interval a -> Interval a -> Bool

-- | Does there exist an <tt>x</tt> in <tt>X</tt>, <tt>y</tt> in <tt>Y</tt>
--   such that <tt>x <a>/=</a> y</tt>?
(/=?) :: Interval a -> Interval a -> Bool

-- | Does there exist an <tt>x</tt> in <tt>X</tt>, <tt>y</tt> in <tt>Y</tt>
--   such that <tt>x <a>&gt;</a> y</tt>?
(>?) :: Precision p => Interval p -> Interval p -> Bool

-- | Does there exist an <tt>x</tt> in <tt>X</tt>, <tt>y</tt> in <tt>Y</tt>
--   such that <tt>x <a>&gt;=</a> y</tt>?
(>=?) :: Precision p => Interval p -> Interval p -> Bool

-- | Does there exist an <tt>x</tt> in <tt>X</tt>, <tt>y</tt> in <tt>Y</tt>
--   such that <tt>x <tt>op</tt> y</tt>?
possibly :: Precision p => (forall b. Ord b => b -> b -> Bool) -> Interval p -> Interval p -> Bool

-- | Check if interval <tt>X</tt> totally contains interval <tt>Y</tt>
--   
--   <pre>
--   &gt;&gt;&gt; (20 ... 40 :: Interval Double) `contains` (25 ... 35 :: Interval Double)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (20 ... 40 :: Interval Double) `contains` (15 ... 35 :: Interval Double)
--   False
--   </pre>
contains :: Precision p => Interval p -> Interval p -> Bool

-- | Flipped version of <a>contains</a>. Check if interval <tt>X</tt> a
--   subset of interval <tt>Y</tt>
--   
--   <pre>
--   &gt;&gt;&gt; (25 ... 35 :: Interval Double) `isSubsetOf` (20 ... 40 :: Interval Double)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (20 ... 40 :: Interval Double) `isSubsetOf` (15 ... 35 :: Interval Double)
--   False
--   </pre>
isSubsetOf :: Precision p => Interval p -> Interval p -> Bool

-- | Calculate the intersection of two intervals.
--   
--   <pre>
--   &gt;&gt;&gt; intersection (1 ... 10 :: Interval Double) (5 ... 15 :: Interval Double)
--   5.0 ... 10.0
--   </pre>
intersection :: Precision p => Interval p -> Interval p -> Interval p

-- | Calculate the convex hull of two intervals
--   
--   <pre>
--   &gt;&gt;&gt; hull (0 ... 10 :: Interval Double) (5 ... 15 :: Interval Double)
--   0.0 ... 15.0
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; hull (15 ... 85 :: Interval Double) (0 ... 10 :: Interval Double)
--   0.0 ... 85.0
--   </pre>
hull :: Precision p => Interval p -> Interval p -> Interval p

-- | Bisect an interval at its midpoint.
--   
--   <pre>
--   &gt;&gt;&gt; bisect (10.0 ... 20.0)
--   (10.0 ... 15.0,15.0 ... 20.0)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; bisect (singleton 5.0)
--   (5.0 ... 5.0,5.0 ... 5.0)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; bisect Empty
--   (Empty,Empty)
--   </pre>
bisect :: Precision p => Interval p -> (Interval p, Interval p)
divNonZero :: Precision p => Interval p -> Interval p -> Interval p
divPositive :: Precision p => Interval p -> Rounded TowardInf p -> Interval p
divNegative :: Precision p => Interval p -> Rounded TowardNegInf p -> Interval p
divZero :: Precision p => Interval p -> Interval p
midpoint :: Precision p => Interval p -> Rounded TowardNegInf p
instance forall k (p :: k). GHC.Generics.Generic (Numeric.Rounded.Interval.Interval p)
instance forall k (p :: k). Numeric.Rounded.Precision.Precision p => GHC.Num.Num (Numeric.Rounded.Interval.Interval p)
instance forall k (p :: k). GHC.Classes.Eq (Numeric.Rounded.Interval.Interval p)
instance forall k (p :: k). Numeric.Rounded.Precision.Precision p => GHC.Classes.Ord (Numeric.Rounded.Interval.Interval p)
instance forall k (p :: k). Numeric.Rounded.Precision.Precision p => GHC.Real.Real (Numeric.Rounded.Interval.Interval p)
instance forall k (p :: k). Numeric.Rounded.Precision.Precision p => GHC.Show.Show (Numeric.Rounded.Interval.Interval p)
instance forall k (p :: k). Numeric.Rounded.Precision.Precision p => GHC.Real.Fractional (Numeric.Rounded.Interval.Interval p)
instance forall k (p :: k). Numeric.Rounded.Precision.Precision p => GHC.Real.RealFrac (Numeric.Rounded.Interval.Interval p)
instance forall k (p :: k). Numeric.Rounded.Precision.Precision p => GHC.Float.Floating (Numeric.Rounded.Interval.Interval p)


-- | This module provides an interface without advanced type system
--   features, that may be more convenient if the precision is changed
--   often.
module Numeric.Rounded.Simple

-- | A properly rounded floating-point number with a given rounding mode
--   and precision.
data Rounded
reifyRounded :: Rounded -> (forall p. Precision p => Rounded r p -> a) -> a
simplify :: Rounded r p -> Rounded
fromInt :: RoundingMode -> Precision -> Int -> Rounded
fromDouble :: RoundingMode -> Precision -> Double -> Rounded
fromLongDouble :: RoundingMode -> Precision -> LongDouble -> Rounded
toDouble :: RoundingMode -> Rounded -> Double
toLongDouble :: RoundingMode -> Rounded -> LongDouble
toInteger' :: RoundingMode -> Rounded -> Integer
precRound :: RoundingMode -> Precision -> Rounded -> Rounded
type Precision = Int
precision :: Rounded -> Precision
data RoundingMode

-- | currently unsupported placeholder
TowardNearestWithTiesAwayFromZero :: RoundingMode

-- | roundTiesToEven in IEEE 754-2008
TowardNearest :: RoundingMode

-- | roundTowardZero in IEEE 754-2008
TowardZero :: RoundingMode

-- | roundTowardPositive in IEEE 754-2008
TowardInf :: RoundingMode

-- | roundTowardNegative in IEEE 754-2008
TowardNegInf :: RoundingMode

-- | round away from zero
AwayFromZero :: RoundingMode

-- | currently unsupported placeholder
Faithfully :: RoundingMode
kPi :: RoundingMode -> Precision -> Rounded
kLog2 :: RoundingMode -> Precision -> Rounded
kEuler :: RoundingMode -> Precision -> Rounded
kCatalan :: RoundingMode -> Precision -> Rounded
min_ :: RoundingMode -> Precision -> Rounded -> Rounded -> Rounded
max_ :: RoundingMode -> Precision -> Rounded -> Rounded -> Rounded
add_ :: RoundingMode -> Precision -> Rounded -> Rounded -> Rounded
sub_ :: RoundingMode -> Precision -> Rounded -> Rounded -> Rounded
mul_ :: RoundingMode -> Precision -> Rounded -> Rounded -> Rounded
negate_ :: RoundingMode -> Precision -> Rounded -> Rounded
abs_ :: RoundingMode -> Precision -> Rounded -> Rounded
fromInteger' :: RoundingMode -> Precision -> Integer -> Rounded
div_ :: RoundingMode -> Precision -> Rounded -> Rounded -> Rounded
fromRational' :: RoundingMode -> Precision -> Rational -> Rounded
toRational' :: RoundingMode -> Rounded -> Rational
properFraction_ :: Integral i => Rounded -> (i, Rounded)
truncate_ :: Precision -> Rounded -> Rounded
round_ :: Precision -> Rounded -> Rounded
ceiling_ :: Precision -> Rounded -> Rounded
floor_ :: Precision -> Rounded -> Rounded
sqrt_ :: RoundingMode -> Precision -> Rounded -> Rounded
exp_ :: RoundingMode -> Precision -> Rounded -> Rounded
expm1_ :: RoundingMode -> Precision -> Rounded -> Rounded
log_ :: RoundingMode -> Precision -> Rounded -> Rounded
log1p_ :: RoundingMode -> Precision -> Rounded -> Rounded
sin_ :: RoundingMode -> Precision -> Rounded -> Rounded
cos_ :: RoundingMode -> Precision -> Rounded -> Rounded
tan_ :: RoundingMode -> Precision -> Rounded -> Rounded
asin_ :: RoundingMode -> Precision -> Rounded -> Rounded
acos_ :: RoundingMode -> Precision -> Rounded -> Rounded
atan_ :: RoundingMode -> Precision -> Rounded -> Rounded
sinh_ :: RoundingMode -> Precision -> Rounded -> Rounded
cosh_ :: RoundingMode -> Precision -> Rounded -> Rounded
tanh_ :: RoundingMode -> Precision -> Rounded -> Rounded
asinh_ :: RoundingMode -> Precision -> Rounded -> Rounded
acosh_ :: RoundingMode -> Precision -> Rounded -> Rounded
atanh_ :: RoundingMode -> Precision -> Rounded -> Rounded
atan2_ :: RoundingMode -> Precision -> Rounded -> Rounded -> Rounded
floatRadix' :: Rounded -> Integer
floatDigits' :: Rounded -> Int
floatRange' :: Rounded -> (Int, Int)
decodeFloat' :: Rounded -> (Integer, Int)
encodeFloat' :: RoundingMode -> Precision -> Integer -> Int -> Rounded
exponent' :: Rounded -> Int
significand' :: Rounded -> Rounded
scaleFloat' :: Int -> Rounded -> Rounded
isNaN' :: Rounded -> Bool
isInfinite' :: Rounded -> Bool
isDenormalized' :: Rounded -> Bool
isNegativeZero' :: Rounded -> Bool
isIEEE' :: Rounded -> Bool
show' :: Rounded -> String
read' :: RoundingMode -> Precision -> String -> Rounded

-- | Use a value as a <i>constant</i> <tt>mpfr_t</tt> (attempts to modify
--   it may explode, changing the precision will explode).
withInRounded :: Rounded -> (Ptr MPFR -> IO a) -> IO a

-- | Allocates and initializes a new <tt>mpfr_t</tt> to the value. After
--   the action it is peeked and returned.
withInOutRounded :: Rounded -> (Ptr MPFR -> IO a) -> IO (Rounded, a)

-- | Allocates and initializes a new <tt>mpfr_t</tt> to the value. After
--   the action it is peeked and returned. The result of the action is
--   ignored.
withInOutRounded_ :: Rounded -> (Ptr MPFR -> IO a) -> IO Rounded

-- | Allocates and initializes a new <tt>mpfr_t</tt>, after the action it
--   is peeked and returned.
withOutRounded :: Precision -> (Ptr MPFR -> IO a) -> IO (Rounded, a)

-- | Allocates and initializes a new <tt>mpfr_t</tt>, after the action it
--   is peeked and returned. The result of the action is ignored.
withOutRounded_ :: Precision -> (Ptr MPFR -> IO a) -> IO Rounded

-- | Peek an <tt>mpfr_t</tt> at its actual precision.
peekRounded :: Ptr MPFR -> IO Rounded
instance GHC.Classes.Eq Numeric.Rounded.Simple.Rounded
instance GHC.Classes.Ord Numeric.Rounded.Simple.Rounded
