Closed cjay closed 2 years ago
I haven't found a specification of what the builtin is supposed to do exactly, but the existing tests would catch if it rounded differently, so pretty sure it behaves like quot
in Haskell.
tests/Plutarch/RationalSpec.hs
4:import Plutarch.Rational (pproperFraction, ptruncate)
32: "5/4" @| ptruncate # rat (5 / 4) @== pconstant @PInteger 1
33: "7/4" @| ptruncate # rat (7 / 4) @== pconstant @PInteger 1
34: "1/4" @| ptruncate # rat (1 / 4) @== pconstant @PInteger 0
35: "-7/4" @| ptruncate # rat (-7 / 4) @== pconstant @PInteger (-1)
you can check the implementation
If PlutusTx.Builtins.Internal
is the right place: quotientInteger
makes use of the normal quot
.
Are we sure QuotientInteger has the same semantics?