Type alias Config

Config: {
    roundingMode: RoundingMode;
    decimalPlaces: number;
    maxDecimalPlaces: number;
    significantDigits: number;
    trailingZeros: boolean;
    toFixed?: {
        decimalPlaces?: number;
        roundingMode?: RoundingMode;
        trailingZeros?: boolean;
    };
    toPrecision?: {
        significantDigits?: number;
        roundingMode?: RoundingMode;
    };
    toExponential?: {
        decimalPlaces?: number;
        roundingMode?: RoundingMode;
        trailingZeros?: boolean;
    };
    toFormat?: {
        decimalPlaces?: number;
        roundingMode?: RoundingMode;
        trailingZeros?: boolean;
        format?: {
            groupSize?: number;
            groupSeparator?: string;
            decimalSeparator?: string;
        };
    };
}

Configuration options for the Fraction class.

Type declaration

  • roundingMode: RoundingMode

    The rounding mode to use when rounding the Fraction. It only apply to methods that may incur rounding(irrational methods), or converting to a or number/string representation.

  • decimalPlaces: number

    The number of decimal places to round to. It only apply to methods that may incur rounding(irrational methods), or converting to a or number/string representation.

  • maxDecimalPlaces: number

    The maximum number of decimal places preserved in the Fraction, it only apply to methods that incur rounding(irrational method).

  • significantDigits: number

    The number of significant digits to preserve when calling the Fraction..toPrecision method.

  • trailingZeros: boolean

    Determines whether trailing zeros are preserved when converting the Fraction to a string representation.

  • Optional toFixed?: {
        decimalPlaces?: number;
        roundingMode?: RoundingMode;
        trailingZeros?: boolean;
    }

    Optional configuration for the Fraction.toFixed method.

    • Optional decimalPlaces?: number

      The number of decimal places to round to.

    • Optional roundingMode?: RoundingMode

      The rounding mode to be applied.

    • Optional trailingZeros?: boolean

      Determines whether trailing zeros are preserved.

  • Optional toPrecision?: {
        significantDigits?: number;
        roundingMode?: RoundingMode;
    }

    Optional configuration for the Fraction.toPrecision method.

    • Optional significantDigits?: number

      The number of significant digits to preserve when using the toPrecision() method.

    • Optional roundingMode?: RoundingMode

      The rounding mode.

  • Optional toExponential?: {
        decimalPlaces?: number;
        roundingMode?: RoundingMode;
        trailingZeros?: boolean;
    }

    Optional configuration for the toExponential() method.

    • Optional decimalPlaces?: number

      The number of decimal places to round to when using the toExponential() method.

    • Optional roundingMode?: RoundingMode

      The rounding mode to be applied.

    • Optional trailingZeros?: boolean

      Determines whether trailing zeros are preserved when using the toExponential() method.

  • Optional toFormat?: {
        decimalPlaces?: number;
        roundingMode?: RoundingMode;
        trailingZeros?: boolean;
        format?: {
            groupSize?: number;
            groupSeparator?: string;
            decimalSeparator?: string;
        };
    }

    Optional configuration for the toFormat() method.

    • Optional decimalPlaces?: number

      The number of decimal places to round to when using the toFormat() method.

    • Optional roundingMode?: RoundingMode

      The rounding mode to be applied.

    • Optional trailingZeros?: boolean

      Determines whether trailing zeros are preserved.

    • Optional format?: {
          groupSize?: number;
          groupSeparator?: string;
          decimalSeparator?: string;
      }

      Formatting options for the Fraction.toFormat method.

      • Optional groupSize?: number

        The grouping size of the integer part, default to 3.

      • Optional groupSeparator?: string

        The grouping separator of the integer part, default to ,.

      • Optional decimalSeparator?: string

        The decimal separator, default to ..

Generated using TypeDoc