pyo3 icon indicating copy to clipboard operation
pyo3 copied to clipboard

Add conversion between fractions.Fraction and num-rational types

Open evan0greenup opened this issue 2 years ago • 4 comments

The int type in Python is unbounded. It would be nice to add int to BigInt and BigUInt conversion into PyO3. (from num-bigint)

And also, there is fractions.Fraction in Python, it would be nice to add the conversion to num-rational types.

https://github.com/rust-num

evan0greenup avatar Apr 14 '23 11:04 evan0greenup

At least num-bigint is already supported (as is num-complex), as an optional feature: https://docs.rs/pyo3/latest/pyo3/#optional-feature-flags

num-rational could be implemented very similarly.

birkenfeld avatar Apr 14 '23 12:04 birkenfeld

Changed the title to quickly indicate that this tracks adding support for num-rational on top of the existing num-bigint and num-complex support.

adamreichold avatar Apr 14 '23 16:04 adamreichold

Added good first issue as this seems like a standalone new conversion and feature in src/conversions.

davidhewitt avatar Apr 02 '24 21:04 davidhewitt

Given that there are other examples I can follow from src/conversions, this is one I would like to give a try as well :).

dmatos2012 avatar Apr 26 '24 07:04 dmatos2012