pyarts.internals.Rational¶
-
class
pyarts.internals.Rational(numerator=0, denominator=None, *, _normalize=True)[source]¶ Rational number
This is a copy of fractions.Fraction with only the __repr__ function over- written to match ARTS style. That is 3/2 is represented as such rather than as “Fraction(3, 2)”. See original class for more information, limitations, and options
Methods
__init__(*args)Initialize self.
as_integer_ratio()Return the integer ratio as a tuple.
conjugate()Conjugate is a no-op for Reals.
from_decimal(dec)Converts a finite Decimal instance to a rational number, exactly.
from_float(f)Converts a finite float to a rational number, exactly.
limit_denominator([max_denominator])Closest Fraction to self with denominator at most max_denominator.
Attributes
denominatorimagReal numbers have no imaginary component.
numeratorrealReal numbers are their real component.