haskus-system-0.6.0.0: Haskus system programming framework

Safe HaskellNone
LanguageHaskell2010

Haskus.Format.Binary.FixedPoint

Description

Fixed-point numbers

Synopsis

Documentation

data FixedPoint w i f Source #

Fixed-point number w is the backing type i is the number of bits for the integer part (before the readix point) f is the number of bits for the fractional part (after the radix point)

Instances

(Integral w, Bits w, Field w, (~) Nat (BitSize w) ((+) n d), KnownNat n, KnownNat d) => Eq (FixedPoint w n d) Source # 

Methods

(==) :: FixedPoint w n d -> FixedPoint w n d -> Bool #

(/=) :: FixedPoint w n d -> FixedPoint w n d -> Bool #

(Integral w, Bits w, Field w, (~) Nat (BitSize w) ((+) n d), KnownNat n, KnownNat d, Show w) => Show (FixedPoint w n d) Source # 

Methods

showsPrec :: Int -> FixedPoint w n d -> ShowS #

show :: FixedPoint w n d -> String #

showList :: [FixedPoint w n d] -> ShowS #

Storable w => Storable (FixedPoint w i f) Source # 

Methods

peekIO :: Ptr (FixedPoint w i f) -> IO (FixedPoint w i f) Source #

pokeIO :: Ptr (FixedPoint w i f) -> FixedPoint w i f -> IO () Source #

alignment :: FixedPoint w i f -> Word Source #

sizeOf :: FixedPoint w i f -> Word Source #

toFixedPoint :: forall a w n d. (RealFrac a, BitSize w ~ (n + d), KnownNat n, KnownNat d, Bits w, Field w, Num w, Integral w) => a -> FixedPoint w n d Source #

Convert to a fixed point value

fromFixedPoint :: forall a w n d. (RealFrac a, BitSize w ~ (n + d), KnownNat n, KnownNat d, Bits w, Field w, Num w, Integral w) => FixedPoint w n d -> a Source #

Convert from a fixed-point value