Rational Numbers and Float #
Convert this rational number to a Float value.
Instances For
Convert this floating point number to a rational value.
Equations
- a.toRat? = Option.map (fun (x : Int × Int) => match x with | (v, exp) => mkRat (v.sign * ↑(v.natAbs <<< exp.toNat)) (1 <<< (-exp).toNat)) a.toRatParts
Instances For
Convert this floating point number to a rational value,
mapping non-finite values (inf, -inf, nan) to 0.
Instances For
@[implicit_reducible]
Equations
- Rat.instCoeFloat_batteries = { coe := Rat.toFloat }