posit-3.2.0.2
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 FixedWidthInteger (IntN es) => 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.

Minimal complete definition

exponentSize

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

PositC 'II Source # 
Instance details

Defined in Posit.Internal.PositC

PositC 'III Source # 
Instance details

Defined in Posit.Internal.PositC

PositC 'IV Source # 
Instance details

Defined in Posit.Internal.PositC

PositC 'V Source # 
Instance details

Defined in Posit.Internal.PositC

PositC 'Z Source # 
Instance details

Defined in Posit.Internal.PositC

data ES Source #

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

Constructors

Z 
I 
II 
III 
IV 
V 

type family IntN (es :: ES) = r | r -> es where ... 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

Equations

IntN Z = Int8 
IntN I = Int16 
IntN II = Int32 
IntN III = Int64 
IntN IV = Int128 
IntN V = Int256 

type FixedWidthInteger a = (Bits a, Bounded a, Enum a, Integral a, Eq a, Ord a, Num a, Read a, Show a, Storable a) Source #

The FixedWidthInteger is a Constraint Synonym that contains all of the constraints provided by the IntN Type Family. It is a super class for the Posit Class.

Orphan instances

Storable Int128 Source # 
Instance details

Storable Int256 Source # 
Instance details

Storable Word128 Source # 
Instance details