Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
What4.Utils.FloatHelpers
Synopsis
- data RoundingMode
- bfStatus :: HasCallStack => (a, Status) -> a
- fppOpts :: FloatPrecisionRepr fpp -> RoundingMode -> BFOpts
- toRoundMode :: RoundingMode -> RoundMode
- fpOpts :: Integer -> Integer -> RoundMode -> BFOpts
- floatFromInteger :: BFOpts -> Integer -> BigFloat
- floatFromRational :: BFOpts -> Rational -> BigFloat
- floatToRational :: BigFloat -> Maybe Rational
- floatToInteger :: RoundingMode -> BigFloat -> Maybe Integer
- floatRoundToInt :: HasCallStack => FloatPrecisionRepr fpp -> RoundingMode -> BigFloat -> BigFloat
Documentation
data RoundingMode Source #
Rounding modes for IEEE-754 floating point operations.
Constructors
RNE | Round to nearest even. |
RNA | Round to nearest away. |
RTP | Round toward plus Infinity. |
RTN | Round toward minus Infinity. |
RTZ | Round toward zero. |
Instances
Enum RoundingMode Source # | |
Defined in What4.Utils.FloatHelpers Methods succ :: RoundingMode -> RoundingMode pred :: RoundingMode -> RoundingMode toEnum :: Int -> RoundingMode fromEnum :: RoundingMode -> Int enumFrom :: RoundingMode -> [RoundingMode] enumFromThen :: RoundingMode -> RoundingMode -> [RoundingMode] enumFromTo :: RoundingMode -> RoundingMode -> [RoundingMode] enumFromThenTo :: RoundingMode -> RoundingMode -> RoundingMode -> [RoundingMode] | |
Generic RoundingMode Source # | |
Defined in What4.Utils.FloatHelpers Associated Types type Rep RoundingMode :: Type -> Type | |
Show RoundingMode Source # | |
Defined in What4.Utils.FloatHelpers Methods showsPrec :: Int -> RoundingMode -> ShowS show :: RoundingMode -> String showList :: [RoundingMode] -> ShowS | |
Eq RoundingMode Source # | |
Defined in What4.Utils.FloatHelpers | |
Ord RoundingMode Source # | |
Defined in What4.Utils.FloatHelpers Methods compare :: RoundingMode -> RoundingMode -> Ordering (<) :: RoundingMode -> RoundingMode -> Bool (<=) :: RoundingMode -> RoundingMode -> Bool (>) :: RoundingMode -> RoundingMode -> Bool (>=) :: RoundingMode -> RoundingMode -> Bool max :: RoundingMode -> RoundingMode -> RoundingMode min :: RoundingMode -> RoundingMode -> RoundingMode | |
Hashable RoundingMode Source # | |
Defined in What4.Utils.FloatHelpers | |
type Rep RoundingMode Source # | |
Defined in What4.Utils.FloatHelpers type Rep RoundingMode = D1 ('MetaData "RoundingMode" "What4.Utils.FloatHelpers" "what4-1.5.1-5lbIrYcdqgBKaFk3NGZiHl" 'False) ((C1 ('MetaCons "RNE" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RNA" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "RTP" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "RTN" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RTZ" 'PrefixI 'False) (U1 :: Type -> Type)))) |
bfStatus :: HasCallStack => (a, Status) -> a Source #
fppOpts :: FloatPrecisionRepr fpp -> RoundingMode -> BFOpts Source #
toRoundMode :: RoundingMode -> RoundMode Source #
fpOpts :: Integer -> Integer -> RoundMode -> BFOpts Source #
Make LibBF options for the given precision and rounding mode.
floatFromInteger :: BFOpts -> Integer -> BigFloat Source #
Make a floating point number from an integer, using the given rounding mode
floatFromRational :: BFOpts -> Rational -> BigFloat Source #
Make a floating point number from a rational, using the given rounding mode
floatToRational :: BigFloat -> Maybe Rational Source #
Convert a floating point number to a rational, if possible.
floatToInteger :: RoundingMode -> BigFloat -> Maybe Integer Source #
Convert a floating point number to an integer, if possible.
floatRoundToInt :: HasCallStack => FloatPrecisionRepr fpp -> RoundingMode -> BigFloat -> BigFloat Source #