Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data FloatInfo
- type HalfFloat = 'HalfFloat
- type SingleFloat = 'SingleFloat
- type DoubleFloat = 'DoubleFloat
- type QuadFloat = 'QuadFloat
- type X86_80Float = 'X86_80Float
- type DoubleDoubleFloat = 'DoubleDoubleFloat
- data FloatInfoRepr (fi :: FloatInfo) where
- data X86_80Val = X86_80Val Word16 Word64
- fp80ToBits :: X86_80Val -> Integer
- fp80ToRational :: X86_80Val -> Maybe Rational
- type family FloatInfoToPrecision (fi :: FloatInfo) :: FloatPrecision where ...
- type family FloatPrecisionToInfo (fpp :: FloatPrecision) :: FloatInfo where ...
- floatInfoToPrecisionRepr :: FloatInfoRepr fi -> FloatPrecisionRepr (FloatInfoToPrecision fi)
- floatPrecisionToInfoRepr :: FloatPrecisionRepr fpp -> FloatInfoRepr (FloatPrecisionToInfo fpp)
- type family FloatInfoToBitWidth (fi :: FloatInfo) :: Nat where ...
- floatInfoToBVTypeRepr :: FloatInfoRepr fi -> BaseTypeRepr (BaseBVType (FloatInfoToBitWidth fi))
- type family SymInterpretedFloatType (sym :: Type) (fi :: FloatInfo) :: BaseType
- type SymInterpretedFloat sym fi = SymExpr sym (SymInterpretedFloatType sym fi)
- class IsExprBuilder sym => IsInterpretedFloatExprBuilder sym where
- iFloatPZero :: sym -> FloatInfoRepr fi -> IO (SymInterpretedFloat sym fi)
- iFloatNZero :: sym -> FloatInfoRepr fi -> IO (SymInterpretedFloat sym fi)
- iFloatNaN :: sym -> FloatInfoRepr fi -> IO (SymInterpretedFloat sym fi)
- iFloatPInf :: sym -> FloatInfoRepr fi -> IO (SymInterpretedFloat sym fi)
- iFloatNInf :: sym -> FloatInfoRepr fi -> IO (SymInterpretedFloat sym fi)
- iFloatLitRational :: sym -> FloatInfoRepr fi -> Rational -> IO (SymInterpretedFloat sym fi)
- iFloatLitSingle :: sym -> Float -> IO (SymInterpretedFloat sym SingleFloat)
- iFloatLitDouble :: sym -> Double -> IO (SymInterpretedFloat sym DoubleFloat)
- iFloatLitLongDouble :: sym -> X86_80Val -> IO (SymInterpretedFloat sym X86_80Float)
- iFloatNeg :: sym -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi)
- iFloatAbs :: sym -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi)
- iFloatSqrt :: sym -> RoundingMode -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi)
- iFloatAdd :: sym -> RoundingMode -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi)
- iFloatSub :: sym -> RoundingMode -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi)
- iFloatMul :: sym -> RoundingMode -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi)
- iFloatDiv :: sym -> RoundingMode -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi)
- iFloatRem :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi)
- iFloatMin :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi)
- iFloatMax :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi)
- iFloatFMA :: sym -> RoundingMode -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi)
- iFloatEq :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (Pred sym)
- iFloatNe :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (Pred sym)
- iFloatFpEq :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (Pred sym)
- iFloatFpApart :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (Pred sym)
- iFloatLe :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (Pred sym)
- iFloatLt :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (Pred sym)
- iFloatGe :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (Pred sym)
- iFloatGt :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (Pred sym)
- iFloatIsNaN :: sym -> SymInterpretedFloat sym fi -> IO (Pred sym)
- iFloatIsInf :: sym -> SymInterpretedFloat sym fi -> IO (Pred sym)
- iFloatIsZero :: sym -> SymInterpretedFloat sym fi -> IO (Pred sym)
- iFloatIsPos :: sym -> SymInterpretedFloat sym fi -> IO (Pred sym)
- iFloatIsNeg :: sym -> SymInterpretedFloat sym fi -> IO (Pred sym)
- iFloatIsSubnorm :: sym -> SymInterpretedFloat sym fi -> IO (Pred sym)
- iFloatIsNorm :: sym -> SymInterpretedFloat sym fi -> IO (Pred sym)
- iFloatIte :: sym -> Pred sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi)
- iFloatCast :: sym -> FloatInfoRepr fi -> RoundingMode -> SymInterpretedFloat sym fi' -> IO (SymInterpretedFloat sym fi)
- iFloatRound :: sym -> RoundingMode -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi)
- iFloatFromBinary :: sym -> FloatInfoRepr fi -> SymBV sym (FloatInfoToBitWidth fi) -> IO (SymInterpretedFloat sym fi)
- iFloatToBinary :: sym -> FloatInfoRepr fi -> SymInterpretedFloat sym fi -> IO (SymBV sym (FloatInfoToBitWidth fi))
- iBVToFloat :: 1 <= w => sym -> FloatInfoRepr fi -> RoundingMode -> SymBV sym w -> IO (SymInterpretedFloat sym fi)
- iSBVToFloat :: 1 <= w => sym -> FloatInfoRepr fi -> RoundingMode -> SymBV sym w -> IO (SymInterpretedFloat sym fi)
- iRealToFloat :: sym -> FloatInfoRepr fi -> RoundingMode -> SymReal sym -> IO (SymInterpretedFloat sym fi)
- iFloatToBV :: 1 <= w => sym -> NatRepr w -> RoundingMode -> SymInterpretedFloat sym fi -> IO (SymBV sym w)
- iFloatToSBV :: 1 <= w => sym -> NatRepr w -> RoundingMode -> SymInterpretedFloat sym fi -> IO (SymBV sym w)
- iFloatToReal :: sym -> SymInterpretedFloat sym fi -> IO (SymReal sym)
- iFloatBaseTypeRepr :: sym -> FloatInfoRepr fi -> BaseTypeRepr (SymInterpretedFloatType sym fi)
- class (IsSymExprBuilder sym, IsInterpretedFloatExprBuilder sym) => IsInterpretedFloatSymExprBuilder sym where
- freshFloatConstant :: sym -> SolverSymbol -> FloatInfoRepr fi -> IO (SymExpr sym (SymInterpretedFloatType sym fi))
- freshFloatLatch :: sym -> SolverSymbol -> FloatInfoRepr fi -> IO (SymExpr sym (SymInterpretedFloatType sym fi))
- freshFloatBoundVar :: sym -> SolverSymbol -> FloatInfoRepr fi -> IO (BoundVar sym (SymInterpretedFloatType sym fi))
FloatInfo data kind
This data kind describes the types of floating-point formats. This consist of the standard IEEE 754-2008 binary floating point formats, as well as the X86 extended 80-bit format and the double-double format.
Instances
Constructors for kind FloatInfo
type SingleFloat Source #
= 'SingleFloat | 32 bit binary IEEE754. |
type DoubleFloat Source #
= 'DoubleFloat | 64 bit binary IEEE754. |
type X86_80Float Source #
= 'X86_80Float | X86 80-bit extended floats. |
type DoubleDoubleFloat Source #
= 'DoubleDoubleFloat | Two 64-bit floats fused in the "double-double" style. |
Representations of FloatInfo types
data FloatInfoRepr (fi :: FloatInfo) where Source #
A family of value-level representatives for floating-point types.
Instances
extended 80 bit float values ("long double")
Representation of 80-bit floating values, since there's no native Haskell type for these.
fp80ToBits :: X86_80Val -> Integer Source #
FloatInfo to/from FloatPrecision
type family FloatInfoToPrecision (fi :: FloatInfo) :: FloatPrecision where ... Source #
type family FloatPrecisionToInfo (fpp :: FloatPrecision) :: FloatInfo where ... Source #
floatInfoToPrecisionRepr :: FloatInfoRepr fi -> FloatPrecisionRepr (FloatInfoToPrecision fi) Source #
floatPrecisionToInfoRepr :: FloatPrecisionRepr fpp -> FloatInfoRepr (FloatPrecisionToInfo fpp) Source #
Bit-width type family
type family FloatInfoToBitWidth (fi :: FloatInfo) :: Nat where ... Source #
floatInfoToBVTypeRepr :: FloatInfoRepr fi -> BaseTypeRepr (BaseBVType (FloatInfoToBitWidth fi)) Source #
Interface classes
Interpretation type family
type family SymInterpretedFloatType (sym :: Type) (fi :: FloatInfo) :: BaseType Source #
Interpretation of the floating point type.
Instances
type SymInterpretedFloatType (ExprBuilder t st (Flags FloatIEEE)) fi Source # | |
Defined in What4.Expr.Builder type SymInterpretedFloatType (ExprBuilder t st (Flags FloatIEEE)) fi = BaseFloatType (FloatInfoToPrecision fi) | |
type SymInterpretedFloatType (ExprBuilder t st (Flags FloatUninterpreted)) fi Source # | |
Defined in What4.Expr.Builder type SymInterpretedFloatType (ExprBuilder t st (Flags FloatUninterpreted)) fi = BaseBVType (FloatInfoToBitWidth fi) | |
type SymInterpretedFloatType (ExprBuilder t st (Flags FloatReal)) fi Source # | |
Defined in What4.Expr.Builder |
Type alias
type SymInterpretedFloat sym fi = SymExpr sym (SymInterpretedFloatType sym fi) Source #
Symbolic floating point numbers.
IsInterpretedFloatExprBuilder
class IsExprBuilder sym => IsInterpretedFloatExprBuilder sym where Source #
Abstact floating point operations.
iFloatPZero :: sym -> FloatInfoRepr fi -> IO (SymInterpretedFloat sym fi) Source #
Return floating point number +0
.
iFloatNZero :: sym -> FloatInfoRepr fi -> IO (SymInterpretedFloat sym fi) Source #
Return floating point number -0
.
iFloatNaN :: sym -> FloatInfoRepr fi -> IO (SymInterpretedFloat sym fi) Source #
Return floating point NaN.
iFloatPInf :: sym -> FloatInfoRepr fi -> IO (SymInterpretedFloat sym fi) Source #
Return floating point +infinity
.
iFloatNInf :: sym -> FloatInfoRepr fi -> IO (SymInterpretedFloat sym fi) Source #
Return floating point -infinity
.
iFloatLitRational :: sym -> FloatInfoRepr fi -> Rational -> IO (SymInterpretedFloat sym fi) Source #
Create a floating point literal from a rational literal.
iFloatLitSingle :: sym -> Float -> IO (SymInterpretedFloat sym SingleFloat) Source #
Create a (single precision) floating point literal.
iFloatLitDouble :: sym -> Double -> IO (SymInterpretedFloat sym DoubleFloat) Source #
Create a (double precision) floating point literal.
iFloatLitLongDouble :: sym -> X86_80Val -> IO (SymInterpretedFloat sym X86_80Float) Source #
Create an (extended double precision) floating point literal.
iFloatNeg :: sym -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi) Source #
Negate a floating point number.
iFloatAbs :: sym -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi) Source #
Return the absolute value of a floating point number.
iFloatSqrt :: sym -> RoundingMode -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi) Source #
Compute the square root of a floating point number.
iFloatAdd :: sym -> RoundingMode -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi) Source #
Add two floating point numbers.
iFloatSub :: sym -> RoundingMode -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi) Source #
Subtract two floating point numbers.
iFloatMul :: sym -> RoundingMode -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi) Source #
Multiply two floating point numbers.
iFloatDiv :: sym -> RoundingMode -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi) Source #
Divide two floating point numbers.
iFloatRem :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi) Source #
Compute the reminder: x - y * n
, where n
in Z is nearest to x / y
.
iFloatMin :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi) Source #
Return the min of two floating point numbers.
iFloatMax :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi) Source #
Return the max of two floating point numbers.
iFloatFMA :: sym -> RoundingMode -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi) Source #
Compute the fused multiplication and addition: (x * y) + z
.
iFloatEq :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (Pred sym) Source #
Check logical equality of two floating point numbers.
iFloatNe :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (Pred sym) Source #
Check logical non-equality of two floating point numbers.
iFloatFpEq :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (Pred sym) Source #
Check IEEE equality of two floating point numbers.
iFloatFpApart :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (Pred sym) Source #
Check IEEE apartness of two floating point numbers.
iFloatLe :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (Pred sym) Source #
Check <=
on two floating point numbers.
iFloatLt :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (Pred sym) Source #
Check <
on two floating point numbers.
iFloatGe :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (Pred sym) Source #
Check >=
on two floating point numbers.
iFloatGt :: sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (Pred sym) Source #
Check >
on two floating point numbers.
iFloatIsNaN :: sym -> SymInterpretedFloat sym fi -> IO (Pred sym) Source #
iFloatIsInf :: sym -> SymInterpretedFloat sym fi -> IO (Pred sym) Source #
iFloatIsZero :: sym -> SymInterpretedFloat sym fi -> IO (Pred sym) Source #
iFloatIsPos :: sym -> SymInterpretedFloat sym fi -> IO (Pred sym) Source #
iFloatIsNeg :: sym -> SymInterpretedFloat sym fi -> IO (Pred sym) Source #
iFloatIsSubnorm :: sym -> SymInterpretedFloat sym fi -> IO (Pred sym) Source #
iFloatIsNorm :: sym -> SymInterpretedFloat sym fi -> IO (Pred sym) Source #
iFloatIte :: sym -> Pred sym -> SymInterpretedFloat sym fi -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi) Source #
If-then-else on floating point numbers.
iFloatCast :: sym -> FloatInfoRepr fi -> RoundingMode -> SymInterpretedFloat sym fi' -> IO (SymInterpretedFloat sym fi) Source #
Change the precision of a floating point number.
iFloatRound :: sym -> RoundingMode -> SymInterpretedFloat sym fi -> IO (SymInterpretedFloat sym fi) Source #
Round a floating point number to an integral value.
iFloatFromBinary :: sym -> FloatInfoRepr fi -> SymBV sym (FloatInfoToBitWidth fi) -> IO (SymInterpretedFloat sym fi) Source #
Convert from binary representation in IEEE 754-2008 format to floating point.
iFloatToBinary :: sym -> FloatInfoRepr fi -> SymInterpretedFloat sym fi -> IO (SymBV sym (FloatInfoToBitWidth fi)) Source #
Convert from floating point from to the binary representation in IEEE 754-2008 format.
iBVToFloat :: 1 <= w => sym -> FloatInfoRepr fi -> RoundingMode -> SymBV sym w -> IO (SymInterpretedFloat sym fi) Source #
Convert a unsigned bitvector to a floating point number.
iSBVToFloat :: 1 <= w => sym -> FloatInfoRepr fi -> RoundingMode -> SymBV sym w -> IO (SymInterpretedFloat sym fi) Source #
Convert a signed bitvector to a floating point number.
iRealToFloat :: sym -> FloatInfoRepr fi -> RoundingMode -> SymReal sym -> IO (SymInterpretedFloat sym fi) Source #
Convert a real number to a floating point number.
iFloatToBV :: 1 <= w => sym -> NatRepr w -> RoundingMode -> SymInterpretedFloat sym fi -> IO (SymBV sym w) Source #
Convert a floating point number to a unsigned bitvector.
iFloatToSBV :: 1 <= w => sym -> NatRepr w -> RoundingMode -> SymInterpretedFloat sym fi -> IO (SymBV sym w) Source #
Convert a floating point number to a signed bitvector.
iFloatToReal :: sym -> SymInterpretedFloat sym fi -> IO (SymReal sym) Source #
Convert a floating point number to a real number.
iFloatBaseTypeRepr :: sym -> FloatInfoRepr fi -> BaseTypeRepr (SymInterpretedFloatType sym fi) Source #
The associated BaseType representative of the floating point interpretation for each format.
Instances
class (IsSymExprBuilder sym, IsInterpretedFloatExprBuilder sym) => IsInterpretedFloatSymExprBuilder sym where Source #
Helper interface for creating new symbolic floating-point constants and variables.
Nothing
freshFloatConstant :: sym -> SolverSymbol -> FloatInfoRepr fi -> IO (SymExpr sym (SymInterpretedFloatType sym fi)) Source #
Create a fresh top-level floating-point uninterpreted constant.
freshFloatLatch :: sym -> SolverSymbol -> FloatInfoRepr fi -> IO (SymExpr sym (SymInterpretedFloatType sym fi)) Source #
Create a fresh floating-point latch variable.
freshFloatBoundVar :: sym -> SolverSymbol -> FloatInfoRepr fi -> IO (BoundVar sym (SymInterpretedFloatType sym fi)) Source #
Creates a floating-point bound variable.
Instances
IsInterpretedFloatExprBuilder (ExprBuilder t st fs) => IsInterpretedFloatSymExprBuilder (ExprBuilder t st fs) Source # | |
Defined in What4.Expr.Builder freshFloatConstant :: forall (fi :: FloatInfo). ExprBuilder t st fs -> SolverSymbol -> FloatInfoRepr fi -> IO (SymExpr (ExprBuilder t st fs) (SymInterpretedFloatType (ExprBuilder t st fs) fi)) Source # freshFloatLatch :: forall (fi :: FloatInfo). ExprBuilder t st fs -> SolverSymbol -> FloatInfoRepr fi -> IO (SymExpr (ExprBuilder t st fs) (SymInterpretedFloatType (ExprBuilder t st fs) fi)) Source # freshFloatBoundVar :: forall (fi :: FloatInfo). ExprBuilder t st fs -> SolverSymbol -> FloatInfoRepr fi -> IO (BoundVar (ExprBuilder t st fs) (SymInterpretedFloatType (ExprBuilder t st fs) fi)) Source # |