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

Instances details
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

Methods

(/) :: Fixed -> Fixed -> Fixed

recip :: Fixed -> Fixed

fromRational :: Rational -> Fixed

Num Fixed Source # 
Instance details

Defined in Numeric.Fixed

Methods

(+) :: Fixed -> Fixed -> Fixed

(-) :: Fixed -> Fixed -> Fixed

(*) :: Fixed -> Fixed -> Fixed

negate :: Fixed -> Fixed

abs :: Fixed -> Fixed

signum :: Fixed -> Fixed

fromInteger :: Integer -> 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

Methods

floatRadix :: Fixed -> Integer

floatDigits :: Fixed -> Int

floatRange :: Fixed -> (Int, Int)

decodeFloat :: Fixed -> (Integer, Int)

encodeFloat :: Integer -> Int -> Fixed

exponent :: Fixed -> Int

significand :: Fixed -> Fixed

scaleFloat :: Int -> Fixed -> Fixed

isNaN :: Fixed -> Bool

isInfinite :: Fixed -> Bool

isDenormalized :: Fixed -> Bool

isNegativeZero :: Fixed -> Bool

isIEEE :: Fixed -> Bool

atan2 :: Fixed -> Fixed -> 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