Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data PRational s = PRational (Term s PInteger) (Term s PPositive)
- preduce :: Term s (PRational :--> PRational)
- pnumerator :: Term s (PRational :--> PInteger)
- pdenominator :: Term s (PRational :--> PPositive)
- pfromInteger :: Term s (PInteger :--> PRational)
- pround :: Term s (PRational :--> PInteger)
- ptruncate :: Term s (PRational :--> PInteger)
- pproperFraction :: Term s (PRational :--> PPair PInteger PRational)
Documentation
A Scott-encoded rational number, with a guaranteed positive denominator (and thus, a canonical form).
Note
This is not the Plutarch equivalent of a Plutus Rational
; for this, you
want PRationalData
from plutarch-ledger-api
. PRational
is designed to
optimize for computation: if you want to do any serious work with rational
numbers that isn't just passing them around, you want to use (or convert to)
PRational
.