| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Unwitch.Convert.Fixed
Description
Conversions from Fixed.
Synopsis
- fromInteger :: HasResolution a => Integer -> Fixed a
- toInteger :: HasResolution a => Fixed a -> Maybe Integer
- toRational :: HasResolution a => Fixed a -> Rational
- toFixed :: (HasResolution a, HasResolution b) => Fixed a -> Maybe (Fixed b)
- toDouble :: HasResolution a => Fixed a -> Double
Documentation
fromInteger :: HasResolution a => Integer -> Fixed a Source #
Converts an Integer to a Fixed value. Infallible.
toInteger :: HasResolution a => Fixed a -> Maybe Integer Source #
Converts a Fixed value to Integer, succeeding only if there is no fractional part (i.e. the value is a whole number).
toRational :: HasResolution a => Fixed a -> Rational Source #
Converts a Fixed value to Rational. Infallible, exact.
toFixed :: (HasResolution a, HasResolution b) => Fixed a -> Maybe (Fixed b) Source #
Converts between Fixed types with potentially different resolutions. Succeeds only if the value can be exactly represented in the target resolution.