fn approximate(val f64) Fraction
approximate returns a Fraction that approcimates the given value to within the default epsilon value (1.0e-4). This means the result will be accurate to 3 places after the decimal.
fn approximate_with_eps(val f64, eps f64) Fraction
approximate_with_eps returns a Fraction
fn fraction(n i64, d i64) Fraction
A factory function for creating a Fraction, adds a boundary condition to ensure that the denominator is non-zero. It automatically converts the negative denominator to positive and adjusts the numerator. NOTE: Fractions created are not reduced by default.
fn (f Fraction) str() string
To String method
fn (f1 Fraction) + (f2 Fraction) Fraction
Fraction add using operator overloading
fn (f1 Fraction) - (f2 Fraction) Fraction
Fraction subtract using operator overloading
fn (f1 Fraction) * (f2 Fraction) Fraction
Fraction multiply using operator overloading
fn (f1 Fraction) / (f2 Fraction) Fraction
Fraction divide using operator overloading
fn (f Fraction) negate() Fraction
Fraction negate method
fn (f Fraction) reciprocal() Fraction
Fraction reciprocal method
fn (f Fraction) reduce() Fraction
Fraction method which reduces the fraction
fn (f Fraction) f64() f64
f64 converts the Fraction to 64-bit floating point
fn (f1 Fraction) equals(f2 Fraction) bool
+-----------------------------+ | Public comparison functions | +-----------------------------+ equals returns true if both the Fractions are equal
fn (f1 Fraction) ge(f2 Fraction) bool
ge returns true if f1 >= f2
fn (f1 Fraction) gt(f2 Fraction) bool
gt returns true if f1 > f2
fn (f1 Fraction) le(f2 Fraction) bool
le returns true if f1 <= f2
fn (f1 Fraction) lt(f2 Fraction) bool
lt returns true if f1 < f2