npm.nicfv.com

    Function rat

    • Convert an arbitrary decimal number into a simplified fraction (or ratio). See mixed() for instructions on how to break out the whole number part.

      Parameters

      • n: number

        The decimal number to convert

      • epsilon: number = 1e-6

        Maximum absolute error

      Returns { den: number; num: number }

      An object containing the fraction's numerator and denominator

      const frac = SMath.rat(0.625); // { num: 5, den: 8 }
      
    MMNEPVFCICPMFPCPTTAAATR