npm.nicfv.com

    Function mixed

    • Convert an arbitrary decimal number into a simplified fraction, after breaking out the whole number part first. See rat() for keeping the number as a ratio without separating the whole number part.

      Parameters

      • n: number

        A decimal number to convert

      • epsilon: number = 1e-6

        Maximum absolute error

      Returns { den: number; num: number; whole: number }

      An object containing the whole part and fraction numerator and denominator

      const frac = SMath.mixed(-8 / 6); // { whole: -1, num: 1, den: 3 }
      
    MMNEPVFCICPMFPCPTTAAATR