| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Numeric.Rounded.Hardware
Synopsis
- newtype Rounded (r :: RoundingMode) a = Rounded {
- getRounded :: a
- data RoundingMode
- class Rounding (r :: RoundingMode)
- class Ord a => RoundedRing a
- class RoundedRing a => RoundedFractional a
- class RoundedRing a => RoundedSqrt a
Documentation
newtype Rounded (r :: RoundingMode) a Source #
A type tagged with a rounding direction.
The rounding direction is effective for a single operation.
You won't get the correctly-rounded result for a compound expression like (a - b * c) :: Rounded 'TowardInf Double.
In particular, a negative literal like -0.1 :: Rounded r Double doesn't yield the correctly-rounded value for -0.1.
To get the correct value, call fromRational explicitly (i.e. fromRational (-0.1) :: Rounded r Double) or use NegativeLiterals extension.
Constructors
| Rounded | |
Fields
| |
Instances
data RoundingMode Source #
The type for IEEE754 rounding-direction attributes.
Constructors
| ToNearest | Round to the nearest value (IEEE754 roundTiesToEven) |
| TowardNegInf | Round downward (IEEE754 roundTowardNegative) |
| TowardInf | Round upward (IEEE754 roundTowardPositive) |
| TowardZero | Round toward zero (IEEE754 roundTowardZero) |
Instances
class Rounding (r :: RoundingMode) Source #
This class allows you to recover the runtime value from a type-level rounding mode.
See rounding.
Minimal complete definition
roundingT
Instances
| Rounding 'ToNearest Source # | |
Defined in Numeric.Rounded.Hardware.Internal.Rounding Methods | |
| Rounding 'TowardNegInf Source # | |
Defined in Numeric.Rounded.Hardware.Internal.Rounding Methods | |
| Rounding 'TowardInf Source # | |
Defined in Numeric.Rounded.Hardware.Internal.Rounding Methods | |
| Rounding 'TowardZero Source # | |
Defined in Numeric.Rounded.Hardware.Internal.Rounding Methods | |
class Ord a => RoundedRing a Source #
Rounding-controlled version of Num.
Minimal complete definition
roundedAdd, roundedSub, roundedMul, roundedFusedMultiplyAdd, backendNameT
Instances
class RoundedRing a => RoundedFractional a Source #
Rounding-controlled version of Fractional.
Minimal complete definition
Instances
class RoundedRing a => RoundedSqrt a Source #
Rounding-controlled version of sqrt.
Minimal complete definition