fixed-0.3: Signed 15.16 precision fixed point arithmetic

Copyright(C) 2014-15 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell98

Numeric.Fixed

Description

Fixed precision arithmetic. This format is the same format used by OpenGL ES 1's GLfixed data type:

One sign bit, 15 bits to the left of the decimal place and 16 bits to the right packed into a 32-bit integer.

Synopsis

Documentation

newtype Fixed Source #

A signed 2s complement 15.16 scale fixed precision number

Constructors

Fixed 

Fields

Instances
Bounded Fixed Source # 
Instance details

Defined in Numeric.Fixed

Enum Fixed Source # 
Instance details

Defined in Numeric.Fixed

Eq Fixed Source # 
Instance details

Defined in Numeric.Fixed

Methods

(==) :: Fixed -> Fixed -> Bool #

(/=) :: Fixed -> Fixed -> Bool #

Floating Fixed Source # 
Instance details

Defined in Numeric.Fixed

Fractional Fixed Source # 
Instance details

Defined in Numeric.Fixed

Num Fixed Source # 
Instance details

Defined in Numeric.Fixed

Ord Fixed Source # 
Instance details

Defined in Numeric.Fixed

Methods

compare :: Fixed -> Fixed -> Ordering #

(<) :: Fixed -> Fixed -> Bool #

(<=) :: Fixed -> Fixed -> Bool #

(>) :: Fixed -> Fixed -> Bool #

(>=) :: Fixed -> Fixed -> Bool #

max :: Fixed -> Fixed -> Fixed #

min :: Fixed -> Fixed -> Fixed #

Real Fixed Source # 
Instance details

Defined in Numeric.Fixed

Methods

toRational :: Fixed -> Rational #

RealFloat Fixed Source # 
Instance details

Defined in Numeric.Fixed

RealFrac Fixed Source # 
Instance details

Defined in Numeric.Fixed

Methods

properFraction :: Integral b => Fixed -> (b, Fixed) #

truncate :: Integral b => Fixed -> b #

round :: Integral b => Fixed -> b #

ceiling :: Integral b => Fixed -> b #

floor :: Integral b => Fixed -> b #

Show Fixed Source # 
Instance details

Defined in Numeric.Fixed

Methods

showsPrec :: Int -> Fixed -> ShowS #

show :: Fixed -> String #

showList :: [Fixed] -> ShowS #

Storable Fixed Source # 
Instance details

Defined in Numeric.Fixed

Methods

sizeOf :: Fixed -> Int #

alignment :: Fixed -> Int #

peekElemOff :: Ptr Fixed -> Int -> IO Fixed #

pokeElemOff :: Ptr Fixed -> Int -> Fixed -> IO () #

peekByteOff :: Ptr b -> Int -> IO Fixed #

pokeByteOff :: Ptr b -> Int -> Fixed -> IO () #

peek :: Ptr Fixed -> IO Fixed #

poke :: Ptr Fixed -> Fixed -> IO () #

fromFixed :: Fixed -> Double Source #

Convert from a Fixed precision value to a Double

toFixed :: Double -> Fixed Source #

Convert from a Double to a Fixed precision value