| Copyright | (c) Michal Konecny |
|---|---|
| License | BSD3 |
| Maintainer | mikkonecny@gmail.com |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell98 |
Numeric.MixedTypes.Round
Contents
Description
- class CanRound t where
- class HasIntegerBounds t where
- specCanRound :: (CanRoundX t, HasIntegers t) => T t -> Spec
- specHasIntegerBounds :: HasIntegerBoundsX t => T t -> Spec
Rounding operations
class CanRound t where Source #
A replacement for Prelude's RealFrac operations, such as round in
which the result type is fixed to Integer.
If RealFrac t and CanTestPosNeg t,
then one can use the default implementation to mirror Prelude's round, etc.
In other cases, it is sufficient to define properFraction.
Methods
properFraction :: t -> (Integer, t) Source #
properFraction :: RealFrac t => t -> (Integer, t) Source #
truncate :: t -> Integer Source #
round :: t -> Integer Source #
round :: HasOrderCertainly t Rational => t -> Integer Source #
ceiling :: t -> Integer Source #
ceiling :: CanTestPosNeg t => t -> Integer Source #
floor :: t -> Integer Source #
floor :: CanTestPosNeg t => t -> Integer Source #
class HasIntegerBounds t where Source #
Tests
specCanRound :: (CanRoundX t, HasIntegers t) => T t -> Spec Source #
HSpec properties that each implementation of CanRound should satisfy.
specHasIntegerBounds :: HasIntegerBoundsX t => T t -> Spec Source #
HSpec properties that each implementation of CanRound should satisfy.