Copyright | (C) 2012-2014 Edward Kmett Daniel Peebles (C) 2013-2018 Claude Heiland-Allen |
---|---|
License | LGPL |
Maintainer | Claude Heiland-Allen <claude@mathr.co.uk> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
This module provides an interface without advanced type system features, that may be more convenient if the precision is changed often.
Synopsis
- 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
- 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
- withInRounded :: Rounded -> (Ptr MPFR -> IO a) -> IO a
- withInOutRounded :: Rounded -> (Ptr MPFR -> IO a) -> IO (Rounded, a)
- withInOutRounded_ :: Rounded -> (Ptr MPFR -> IO a) -> IO Rounded
- withOutRounded :: Precision -> (Ptr MPFR -> IO a) -> IO (Rounded, a)
- withOutRounded_ :: Precision -> (Ptr MPFR -> IO a) -> IO Rounded
- peekRounded :: Ptr MPFR -> IO Rounded
Floating point numbers with a specified rounding mode and precision
A properly rounded floating-point number with a given rounding mode and precision.
fromDouble :: RoundingMode -> Precision -> Double -> Rounded Source #
fromLongDouble :: RoundingMode -> Precision -> LongDouble -> Rounded Source #
toLongDouble :: RoundingMode -> Rounded -> LongDouble Source #
toInteger' :: RoundingMode -> Rounded -> Integer Source #
Precision
Rounding
data RoundingMode Source #
TowardNearestWithTiesAwayFromZero | currently unsupported placeholder |
TowardNearest | roundTiesToEven in IEEE 754-2008 |
TowardZero | roundTowardZero in IEEE 754-2008 |
TowardInf | roundTowardPositive in IEEE 754-2008 |
TowardNegInf | roundTowardNegative in IEEE 754-2008 |
AwayFromZero | round away from zero |
Faithfully | currently unsupported placeholder |
Instances
Useful Constants
Ord
Num
fromInteger' :: RoundingMode -> Precision -> Integer -> Rounded Source #
Fractional
fromRational' :: RoundingMode -> Precision -> Rational -> Rounded Source #
Real
toRational' :: RoundingMode -> Rounded -> Rational Source #
RealFrac
Floating
RealFloat
floatRadix' :: Rounded -> Integer Source #
floatDigits' :: Rounded -> Int Source #
encodeFloat' :: RoundingMode -> Precision -> Integer -> Int -> Rounded Source #
significand' :: Rounded -> Rounded Source #
isInfinite' :: Rounded -> Bool Source #
isDenormalized' :: Rounded -> Bool Source #
isNegativeZero' :: Rounded -> Bool Source #
Show
Read
Foreign Function Interface
withInRounded :: Rounded -> (Ptr MPFR -> IO a) -> IO a Source #
Use a value as a constant mpfr_t
(attempts to modify it may explode,
changing the precision will explode).
withInOutRounded :: Rounded -> (Ptr MPFR -> IO a) -> IO (Rounded, a) Source #
Allocates and initializes a new mpfr_t
to the value. After the action
it is peeked and returned.
withInOutRounded_ :: Rounded -> (Ptr MPFR -> IO a) -> IO Rounded Source #
Allocates and initializes a new mpfr_t
to the value. After the action
it is peeked and returned.
The result of the action is ignored.
withOutRounded :: Precision -> (Ptr MPFR -> IO a) -> IO (Rounded, a) Source #
Allocates and initializes a new mpfr_t
, after the action it is peeked
and returned.