| Copyright | (c) Ashley Yakeley 2005 2006 2009 |
|---|---|
| License | BSD-style (see the file libraries/base/LICENSE) |
| Maintainer | Ashley Yakeley <ashley@semantic.org> |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | Trustworthy |
| Language | Haskell2010 |
Data.Fixed
Description
This module defines a "Fixed" type for fixed-precision arithmetic. The parameter to Fixed is any type that's an instance of HasResolution. HasResolution has a single method that gives the resolution of the Fixed type.
This module also contains generalisations of div, mod, and divmod to work with any Real instance.
divMod' :: (Real a,Integral b) => a -> a -> (b, a)Source#
generalisation ofdivMod to any instance of Real
The type parameter should be an instance ofHasResolution.
| Enum (Fixed a)Source# | Since: 2.1 |
Instance detailsDefined inData.Fixed Methods succ ::Fixed a ->Fixed aSource# pred ::Fixed a ->Fixed aSource# fromEnum ::Fixed a ->IntSource# enumFrom ::Fixed a -> [Fixed a]Source# enumFromThen ::Fixed a ->Fixed a -> [Fixed a]Source# enumFromTo ::Fixed a ->Fixed a -> [Fixed a]Source# enumFromThenTo ::Fixed a ->Fixed a ->Fixed a -> [Fixed a]Source# | |
| Eq (Fixed a)Source# | Since: 2.1 |
| HasResolution a =>Fractional (Fixed a)Source# | Since: 2.1 |
| Typeable a =>Data (Fixed a)Source# | Since: 4.1.0.0 |
Instance detailsDefined inData.Fixed Methods gfoldl :: (forall d b.Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) ->Fixed a -> c (Fixed a)Source# gunfold :: (forall b r.Data b => c (b -> r) -> c r) -> (forall r. r -> c r) ->Constr -> c (Fixed a)Source# toConstr ::Fixed a ->ConstrSource# dataTypeOf ::Fixed a ->DataTypeSource# dataCast1 ::Typeable t => (forall d.Data d => c (t d)) ->Maybe (c (Fixed a))Source# dataCast2 ::Typeable t => (forall d e. (Data d,Data e) => c (t d e)) ->Maybe (c (Fixed a))Source# gmapT :: (forall b.Data b => b -> b) ->Fixed a ->Fixed aSource# gmapQl :: (r -> r' -> r) -> r -> (forall d.Data d => d -> r') ->Fixed a -> rSource# gmapQr :: (r' -> r -> r) -> r -> (forall d.Data d => d -> r') ->Fixed a -> rSource# gmapQ :: (forall d.Data d => d -> u) ->Fixed a -> [u]Source# gmapQi ::Int -> (forall d.Data d => d -> u) ->Fixed a -> uSource# gmapM ::Monad m => (forall d.Data d => d -> m d) ->Fixed a -> m (Fixed a)Source# gmapMp ::MonadPlus m => (forall d.Data d => d -> m d) ->Fixed a -> m (Fixed a)Source# gmapMo ::MonadPlus m => (forall d.Data d => d -> m d) ->Fixed a -> m (Fixed a)Source# | |
| HasResolution a =>Num (Fixed a)Source# | Since: 2.1 |
| Ord (Fixed a)Source# | Since: 2.1 |
| HasResolution a =>Read (Fixed a)Source# | Since: 4.3.0.0 |
| HasResolution a =>Real (Fixed a)Source# | Since: 2.1 |
| HasResolution a =>RealFrac (Fixed a)Source# | Since: 2.1 |
| HasResolution a =>Show (Fixed a)Source# | Since: 2.1 |
classHasResolution awhereSource#
Methods
resolution :: p a ->IntegerSource#
| HasResolutionE12Source# | Since: 2.1 |
| HasResolutionE9Source# | Since: 4.1.0.0 |
| HasResolutionE6Source# | Since: 2.1 |
| HasResolutionE3Source# | Since: 4.1.0.0 |
| HasResolutionE2Source# | Since: 4.1.0.0 |
| HasResolutionE1Source# | Since: 4.1.0.0 |
| HasResolutionE0Source# | Since: 4.1.0.0 |
showFixed ::HasResolution a =>Bool ->Fixed a ->StringSource#
First arg is whether to chop off trailing zeros
| HasResolutionE0Source# | Since: 4.1.0.0 |
| HasResolutionE1Source# | Since: 4.1.0.0 |
| HasResolutionE2Source# | Since: 4.1.0.0 |
| HasResolutionE3Source# | Since: 4.1.0.0 |
| HasResolutionE6Source# | Since: 2.1 |
| HasResolutionE9Source# | Since: 4.1.0.0 |
| HasResolutionE12Source# | Since: 2.1 |
Produced byHaddock version 2.20.0