Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
Rounded | |
|
Instances
data RoundingMode Source #
The type for IEEE754 rounding-direction attributes.
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
.
roundingT
class Ord a => RoundedRing a Source #
Rounding-controlled version of Num
.
Instances
class RoundedRing a => RoundedFractional a Source #
Rounding-controlled version of Fractional
.
Instances
class RoundedRing a => RoundedSqrt a Source #
Rounding-controlled version of sqrt
.