posit-3.2.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Posit.Internal.PositC

Description

Library implementing standard 'Posit-3.2' numbers, as defined by the Posit Working Group 23 June 2018.

Synopsis

Documentation

class PositC (es :: ES) where Source #

The Posit class is an approximation of ℝ, it is like a sampling on the Projective Real line ℙ(ℝ) with Maybe ℚ as the internal type. The es is an index that controlls the log2 word size of the Posit's fininte precision representation.

Associated Types

type IntN es = r | r -> es Source #

Type of the Finite Precision Representation, in our case Int8, Int16, Int32, Int64, Int128, Int256. The es of kind ES will determine a result of r such that you can determine the es by the r

Methods

encode Source #

Arguments

:: Maybe Rational 
-> IntN es

Maybe you have some Rational Number and you want to encode it as some integer with a finite integer log2 word size.

Transform to/from the Infinite Precision Representation

decode Source #

Arguments

:: IntN es 
-> Maybe Rational

You have an integer with a finite integer log2 word size decode it and Maybe it is Rational

exponentSize Source #

Arguments

:: Natural

The exponent size, es is a Natural number

Exponent Size based on the Posit Exponent kind ES

nBytes Source #

Arguments

:: Natural

nBytes the number of bytes of the Posit Representation

Various other size definitions used in the Posit format with their default definitions

nBits Source #

Arguments

:: Natural

nBits the number of bits of the Posit Representation

signBitSize Source #

Arguments

:: Natural

signBitSize the size of the sign bit

uSeed Source #

Arguments

:: Natural

uSeed scaling factor for the regime of the Posit Representation

unReal Source #

Arguments

:: IntN es

unReal is something that is not Real, the integer value that is not a Real number

Integer Representation of common bounds

mostPosVal :: IntN es Source #

leastPosVal :: IntN es Source #

leastNegVal :: IntN es Source #

mostNegVal :: IntN es Source #

maxPosRat :: Rational Source #

minPosRat :: Rational Source #

maxNegRat :: Rational Source #

minNegRat :: Rational Source #

log_uSeed :: (Integer, Rational) -> (Integer, Rational) Source #

getRegime :: Rational -> (Integer, Rational) Source #

posit2TupPosit :: Rational -> (Bool, Integer, Natural, Rational) Source #

buildIntRep :: Rational -> IntN es Source #

mkIntRep :: Integer -> Natural -> Rational -> IntN es Source #

formRegime :: Integer -> (IntN es, Integer) Source #

formExponent :: Natural -> Integer -> (IntN es, Integer) Source #

formFraction :: Rational -> Integer -> IntN es Source #

tupPosit2Posit :: (Bool, Integer, Natural, Rational) -> Maybe Rational Source #

regime2Integer :: IntN es -> (Integer, Int) Source #

findRegimeFormat :: IntN es -> Bool Source #

countRegimeBits :: Bool -> IntN es -> Int Source #

exponent2Nat :: Int -> IntN es -> Natural Source #

fraction2Posit :: Int -> IntN es -> Rational Source #

displayBin :: IntN es -> String Source #

decimalPrec :: Int Source #

Instances

Instances details
PositC 'I Source # 
Instance details

Defined in Posit.Internal.PositC

Associated Types

type IntN 'I = (r :: Type) Source #

PositC 'II Source # 
Instance details

Defined in Posit.Internal.PositC

Associated Types

type IntN 'II = (r :: Type) Source #

PositC 'III Source # 
Instance details

Defined in Posit.Internal.PositC

Associated Types

type IntN 'III = (r :: Type) Source #

PositC 'IV Source # 
Instance details

Defined in Posit.Internal.PositC

Associated Types

type IntN 'IV = (r :: Type) Source #

PositC 'V Source # 
Instance details

Defined in Posit.Internal.PositC

Associated Types

type IntN 'V = (r :: Type) Source #

PositC 'Z Source # 
Instance details

Defined in Posit.Internal.PositC

Associated Types

type IntN 'Z = (r :: Type) Source #

data ES Source #

The Exponent Size ES kind, the constructor for the Type is a Roman Numeral.

Constructors

Z 
I 
II 
III 
IV 
V 

Orphan instances

Storable Int128 Source # 
Instance details

Storable Int256 Source # 
Instance details

Storable Word128 Source # 
Instance details