Documentation

Batteries.Data.Rat.Float

Rational Numbers and Float #

def Rat.toFloat (a : Rat) :

Convert this rational number to a Float value.

Equations
  • a.toFloat = a.num.divFloat a.den
Instances For

    Convert this floating point number to a rational value.

    Equations
    Instances For

      Convert this floating point number to a rational value, mapping non-finite values (inf, -inf, nan) to 0.

      Equations
      • a.toRat0 = a.toRat?.getD 0
      Instances For