posit-3.2.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Posit

Description

Library implementing standard Posit Numbers (Posit Standard version 3.2.0.0, with some improvements) a fixed width word size of 2^es bytes.

Synopsis

Main Exported Types

type Posit8 = Posit Z Source #

An 8-bit Posit number with es ~ Z

type Posit16 = Posit I Source #

An 16-bit Posit number with es ~ I

type Posit32 = Posit II Source #

An 32-bit Posit number with es ~ II

type Posit64 = Posit III Source #

An 64-bit Posit number with es ~ III

type Posit128 = Posit IV Source #

An 128-bit Posit number with es ~ IV

type Posit256 = Posit V Source #

An 256-bit Posit number with es ~ V

Patterns for Matching Exported Types

pattern NaR :: PositC es => Posit es Source #

Not a Real Number, the Posit is like a Maybe type, it's either a real number or not

A pattern for Exception handling when a value is Not a Real number (NaR).

pattern R :: PositC es => Rational -> Posit es Source #

A Real or at least Rational Number, rounded to the nearest Posit Rational representation

A pattern for the non-Exceptional case, yielding a Rational, will make a total function when paired with NaR, if the Rational implementation is total.

Fused Operation Interface defined by the Posit Standard

class Num a => FusedOps a where Source #

A class that delays the rounding operation until the end for some operations

Methods

fma :: a -> a -> a -> a Source #

Fused Multiply Add: (a * b) + c

fam :: a -> a -> a -> a Source #

Fused Add Multiply: (a + b) * c

fmms :: a -> a -> a -> a -> a Source #

Fused Multiply Multiply Subtract: (a * b) - (c * d)

fsum3 :: a -> a -> a -> a Source #

Fused Sum of 3 values: a + b + c

fsum4 :: a -> a -> a -> a -> a Source #

Fused Sum of 4 values: a + b + c + d

fsumL :: Foldable t => t a -> a Source #

Fused Sum of a List of Posits

fdot3 :: a -> a -> a -> a -> a -> a -> a Source #

Fused Dot Product of 3 element vector: (a1 * b1) + (a2 * b2) + (a3 * b3)

fdot4 :: a -> a -> a -> a -> a -> a -> a -> a -> a Source #

Fused Dot Product of 4 element vector: (a0 * b0) + (a1 * b1) + (a2 * b2) + (a3 * b3)

fdotL :: Foldable t => t a -> t a -> a Source #

Fused Dot Product of Two Lists

fsm :: a -> a -> a -> a Source #

Fused Subtract Multiply: a - (b * c)

Posits are Convertable between different Posit representations

class Convertible a b where Source #

A Convertible class that will cast or convert between two different Posit es types

Methods

convert :: a -> b Source #

Additional functions to show the Posit in different formats

class AltShow a where Source #

A Alternative to the typical Show class to assist in displaying the Posit es type in different formats

Methods

displayBinary :: a -> String Source #

Display the Posit in its Binary Representation

displayIntegral :: a -> String Source #

Display the Posit in its Integral Representation

displayRational :: a -> String Source #

Display the Posit as a Rational

displayDecimal :: a -> String Source #

Display the Posit as a Decimal until the Repetend occurs

Additional Special Functions

class AltFloating p where Source #

Methods

phi :: p Source #

gamma :: p -> p Source #

sinc :: p -> p Source #

expm1 :: p -> p Source #

Functions to lift functions of Integers or Rationals to operate on Posit Types

viaIntegral :: forall es. PositC es => (IntN es -> IntN es) -> Posit es -> Posit es Source #

viaRational :: (PositC es, Ord (IntN es), Num (IntN es)) => (Rational -> Rational) -> Posit es -> Posit es Source #

viaRational2 :: (PositC es, Ord (IntN es), Num (IntN es)) => (Rational -> Rational -> Rational) -> Posit es -> Posit es -> Posit es Source #

viaRational3 :: (PositC es, Ord (IntN es), Num (IntN es)) => (Rational -> Rational -> Rational -> Rational) -> Posit es -> Posit es -> Posit es -> Posit es Source #

viaRational4 :: (PositC es, Ord (IntN es), Num (IntN es)) => (Rational -> Rational -> Rational -> Rational -> Rational) -> Posit es -> Posit es -> Posit es -> Posit es -> Posit es Source #

viaRational6 :: (PositC es, Ord (IntN es), Num (IntN es)) => (Rational -> Rational -> Rational -> Rational -> Rational -> Rational -> Rational) -> Posit es -> Posit es -> Posit es -> Posit es -> Posit es -> Posit es -> Posit es Source #

viaRational8 :: (PositC es, Ord (IntN es), Num (IntN es)) => (Rational -> Rational -> Rational -> Rational -> Rational -> Rational -> Rational -> Rational -> Rational) -> Posit es -> Posit es -> Posit es -> Posit es -> Posit es -> Posit es -> Posit es -> Posit es -> Posit es Source #