liqwid-plutarch-extra-3.21.1: A collection of Plutarch extras from Liqwid Labs
Safe HaskellSafe-Inferred
LanguageHaskell2010

Plutarch.Extra.Numeric

Synopsis

Documentation

peven :: forall (a :: S -> Type) (s :: S). (PIntegral a, PEq a, PNum a) => Term s (a :--> PBool) Source #

Since: 1.0.0

(#^) :: forall (s :: S) (n :: S -> Type) (e :: S -> Type). (PNum n, PNum e, PEq e, PIntegral e) => Term s n -> Term s e -> Term s n infixr 8 Source #

Power to a PIntegral exponent. Exponent must be >= 0. Only use this if the exponent isn't statically known!

Performance note: Haskell (^) already works for Plutarch if the exponent is Integral (can just be Int or Integer, if known statically), and the base is in Num, which is the case for most/all Plutarch numeric types. It probably performs better, due to the exponent calculations being done ahead of time.

Performance note: When working with PRational, you most likely want to use the PRationalNoReduce wrapper to prevent reducing after each internal multiplication.

Since: 3.12.2