@travishorn/financejs
    Preparing search index...

    Function dollarfr

    • Converts a decimal number to a fractional dollar number, such as a securities price.

      Remarks:

      • If fraction is not an integer, it is truncated.
      • If fraction is less than 0, this function will throw a RangeError.
      • If fraction is 0, division by zero is impossible and this function will throw a RangeError.

      Parameters

      • decimalDollar: number

        A decimal number.

      • fraction: number

        The integer to use in the denominator of the fraction.

      Returns number

      the converted dollar price expressed as a fractional dollar number

      dollarfr(1.125, 16); // 1.02