feldspar-language-0.6.0.2: A functional embedded language for DSP and parallelism

Safe Haskell | None

Feldspar.FixedPoint

Synopsis

- data Fix a = Fix {
  - exponent :: Data IntN
  - mantissa :: Data a
  }
- class Splittable t => Fixable t where
  - fix :: Data IntN -> t -> t
  - getExp :: t -> Data IntN
- freezeFix :: Type a => Fix a -> (Data IntN, Data a)
- freezeFix' :: Bits a => IntN -> Fix a -> Data a
- unfreezeFix :: Type a => (Data IntN, Data a) -> Fix a
- unfreezeFix' :: IntN -> Data a -> Fix a
- (?!) :: forall a. (Syntax a, Splittable a) => Data Bool -> (a, a) -> a
- fixFold :: forall a b. Splittable a => (a -> b -> a) -> a -> Vector b -> a

# Documentation

data Fix a

Abstract real number type with exponent and mantissa

Constructors

Fix |
Fields exponent :: Data IntN mantissa :: Data a

Instances

Type a => Eq (Fix a) |
(Integral a, Bits a, Real a) => Fractional (Fix a) |
(Integral a, Bits a, Real a) => Num (Fix a) |
Type a => Show (Fix a) |
Type a => Syntactic (Fix a) |
Type a => Syntax (Fix a) |
Bits a => Splittable (Fix a) |
Bits a => Fixable (Fix a) |

class Splittable t => Fixable t where

Operations to get and set exponent

Methods

fix :: Data IntN -> t -> t

getExp :: t -> Data IntN

Instances

Fixable (Data Float) |
Bits a => Fixable (Fix a) |

freezeFix :: Type a => Fix a -> (Data IntN, Data a)

Converts an abstract real number to a pair of exponent and mantissa

freezeFix' :: Bits a => IntN -> Fix a -> Data a

Converts an abstract real number to fixed point integer with given exponent

unfreezeFix :: Type a => (Data IntN, Data a) -> Fix a

Converts a pair of exponent and mantissa to an abstract real number

unfreezeFix' :: IntN -> Data a -> Fix a

Converts a fixed point integer with given exponent to an abstract real number

(?!) :: forall a. (Syntax a, Splittable a) => Data Bool -> (a, a) -> a

A version of branching for fixed point algorithms

fixFold :: forall a b. Splittable a => (a -> b -> a) -> a -> Vector b -> a

A version of vector fold for fixed point algorithms