| 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.
- div' :: (Real a, Integral b) => a -> a -> b
- mod' :: Real a => a -> a -> a
- divMod' :: (Real a, Integral b) => a -> a -> (b, a)
- newtype Fixed a = MkFixed Integer
- class HasResolution a where
- showFixed :: HasResolution a => Bool -> Fixed a -> String
- data E0
- type Uni = Fixed E0
- data E1
- type Deci = Fixed E1
- data E2
- type Centi = Fixed E2
- data E3
- type Milli = Fixed E3
- data E6
- type Micro = Fixed E6
- data E9
- type Nano = Fixed E9
- data E12
- type Pico = Fixed E12
Documentation
divMod' :: (Real a, Integral b) => a -> a -> (b, a) Source #
generalisation of divMod to any instance of Real
The type parameter should be an instance of HasResolution.
Instances
| Enum (Fixed a) Source # | Since: 2.1 | 
| Eq (Fixed a) Source # | |
| HasResolution a => Fractional (Fixed a) Source # | Since: 2.1 | 
| Typeable * a => Data (Fixed a) Source # | Since: 4.1.0.0 | 
| HasResolution a => Num (Fixed a) Source # | Since: 2.1 | 
| Ord (Fixed a) Source # | |
| 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 | 
class HasResolution a where Source #
Minimal complete definition
Methods
resolution :: p a -> Integer Source #
Instances
| HasResolution E12 Source # | Since: 2.1 | 
| HasResolution E9 Source # | Since: 4.1.0.0 | 
| HasResolution E6 Source # | Since: 2.1 | 
| HasResolution E3 Source # | Since: 4.1.0.0 | 
| HasResolution E2 Source # | Since: 4.1.0.0 | 
| HasResolution E1 Source # | Since: 4.1.0.0 | 
| HasResolution E0 Source # | Since: 4.1.0.0 |