lorentz-0.14.1: EDSL for the Michelson Language
Safe HaskellSafe-Inferred
LanguageHaskell2010

Lorentz.CustomArith.Conversions

Synopsis

Rational to Fixed/NFixed

convertFixedToRational :: forall a s. HasResolution a => (Fixed a ': s) :-> (Rational ': s) Source #

Converts Rational to Fixed using value inside as numerator and base as denominator

convertNFixedToRational :: forall a s. HasResolution a => (NFixed a ': s) :-> (Rational ': s) Source #

Converts Rational to NFixed using value inside as numerator and base as denominator

convertRationalToFixed :: forall a s. HasResolution a => (Rational ': s) :-> (Fixed a ': s) Source #

Converts Fixed to Rational according to formulae: numerator * base / denominator Note: Since result's base is determined by user, it is recommended to use higher value in order to achieve better accuracy

convertRationalToNFixed :: forall a s. HasResolution a => (Rational ': s) :-> (Maybe (NFixed a) ': s) Source #

NRational to Fixed/NFixed

convertFixedToNRational :: forall a s. HasResolution a => (Fixed a ': s) :-> (Maybe NRational ': s) Source #

Converts Fixed to NRational if it is greater than zero. If not, returns Nothing

unsafeConvertFixedToNRational :: forall a s. HasResolution a => (Fixed a ': s) :-> (NRational ': s) Source #

Converts Fixed to NRational, using abs on numerator.

convertNFixedToNRational :: forall a s. HasResolution a => (NFixed a ': s) :-> (NRational ': s) Source #

Converts NFixed to NRational.

convertNRationalToFixed :: forall a s. HasResolution a => (NRational ': s) :-> (Fixed a ': s) Source #

Converts NRational to Fixed.

convertNRationalToNFixed :: forall a s. HasResolution a => (NRational ': s) :-> (NFixed a ': s) Source #

Converts NRational to NFixed.