Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Fractions/Rationals #40

Open
nielstron opened this issue Feb 1, 2023 · 1 comment
Open

Implement Fractions/Rationals #40

nielstron opened this issue Feb 1, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@nielstron
Copy link
Contributor

nielstron commented Feb 1, 2023

Is your feature request related to a problem? Please describe.
A lot of sophisticated applications require fractions. This is not native to UPLC and hence not easy to represent in python

Describe the solution you'd like
A sample implementation of fractionals similar to the Plutus implementation would be good and simple to use

Optimally, this uses UPLC primitives and is thus fast and efficient.

For the user this should be importable as from fractions import Fraction or something in this direction
https://docs.python.org/3/library/fractions.html

Describe alternatives you've considered
One could also write a prelude-like implementation of fractions that uses a PlutusData or Tuple Object to represent fractions instead. Since we could exploit the native Pair structure of UPLC though it might make sense to use a native UPLC implementation instead.

Additional context
https://github.com/input-output-hk/plutus/blob/master/plutus-tx/src/PlutusTx/Ratio.hs
https://github.com/Plutonomicon/pluto/blob/main/examples/field-of-rationals.pluto

@nielstron nielstron changed the title Implement an implementation of Fractions Implement Fractions/Rationals Feb 1, 2023
@nielstron nielstron added the enhancement New feature or request label Feb 2, 2023
@nielstron
Copy link
Contributor Author

The current workaround is #108

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant