[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#1075905: ITP: python-fraction -- Fraction carries out all the fraction operations including addition, subtraction, multiplication, division, reciprocation



Yogeswaran Umasankar <yogu@debian.org> writes:

> As I look further, it appears that standard Python libs such as float or
> decimal.Decimal do not provide exact representation of rational numbers
> (fractions) without potential loss of precision. Seems ‘fraction’
> package yield exact results because those functions directly work on
> fractions (to my limited understanding).

> decimal.Decimal is better than float, but it only extends to arbitrary
> precision decimal arithmetic, not exact representation of rational
> numbers. Given that these libraries could potentially serve as
> dependencies for tensor-related packages and beyond, should we consider
> bringing 'fraction' or restrict ourselves to float (which is a fallback
> in moarchiving if fraction unavailable)?

I think the suggestion is to use the Python standard library package
"fractions" specifically:

https://docs.python.org/3/library/fractions.html

-- 
Russ Allbery (rra@debian.org)              <https://www.eyrie.org/~eagle/>


Reply to: