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 HaskellSafe-Inferred
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
Storable Fixed Source # 
Instance details

Defined in Numeric.Fixed

Bounded Fixed Source # 
Instance details

Defined in Numeric.Fixed

Enum Fixed Source # 
Instance details

Defined in Numeric.Fixed

Floating Fixed Source # 
Instance details

Defined in Numeric.Fixed

RealFloat Fixed Source # 
Instance details

Defined in Numeric.Fixed

Num Fixed Source # 
Instance details

Defined in Numeric.Fixed

Fractional Fixed Source # 
Instance details

Defined in Numeric.Fixed

Real Fixed Source # 
Instance details

Defined in Numeric.Fixed

RealFrac Fixed Source # 
Instance details

Defined in Numeric.Fixed

Methods

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

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

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

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

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

Show Fixed Source # 
Instance details

Defined in Numeric.Fixed

Eq Fixed Source # 
Instance details

Defined in Numeric.Fixed

Methods

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

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

Ord Fixed Source # 
Instance details

Defined in Numeric.Fixed

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