mirror of
https://github.com/erg-lang/erg.git
synced 2025-07-13 16:15:15 +00:00
20 lines
704 B
Python
20 lines
704 B
Python
decimal = pyimport "decimal"
|
|
|
|
.Fraction: ClassType
|
|
.Fraction <: Eq
|
|
.Fraction <: Hash
|
|
.Fraction <: Ord
|
|
.Fraction.
|
|
numerator: Int
|
|
denominator: Int
|
|
__call__: \
|
|
((numerator := Int, denominator := Int) -> .Fraction) \
|
|
and ((string: decimal.Decimal) -> .Fraction) \
|
|
and (string: Str) -> .Fraction
|
|
as_integer_ratio: (self: .Fraction) -> (Int, Int)
|
|
from_float: (float: Float) -> .Fraction
|
|
from_decimal: (decimal: decimal.Decimal) -> .Fraction
|
|
limit_denominator: (self: .Fraction, max_denominator := Int) -> .Fraction
|
|
__floor__: (self: .Fraction) -> Int
|
|
__ceil__: (self: .Fraction) -> Int
|
|
__round__: (self: .Fraction, ndights := Int) -> Int
|