Skip to content

@technobuddha > library > Math > Verbalization

Type Alias: FractionOptions

ts
type FractionOptions = {
  and?: Numbering["and"];
  denominators?: Numbering["denominators"];
  hyphen?: Numbering["hyphen"];
  ordinal?: Numbering["ordinal"];
  output?:   | "numeric"
     | "alphabetic"
     | "hybrid"
     | Numbering["output"];
  precision?: Numbering["precision"];
  shift?: Numbering["shift"];
  tolerance?: Numbering["tolerance"];
};

Defined in: fraction.ts:9

Options for customizing the output and behavior of fraction number representations.

Properties

PropertyTypeDefault valueDescriptionDefined in
and?Numbering["and"](empty string)Text to use for "and" in compound numbers (e.g., "one hundred and one").src/fraction.ts:20
denominators?Numbering["denominators"]'common'Type of denominators to use when expressing fractions.src/fraction.ts:38
hyphen?Numbering["hyphen"]' ' (space)Text to use for hyphens in compound numbers (e.g., "twenty-one").src/fraction.ts:26
ordinal?Numbering["ordinal"]falseWhether to output ordinal numbers (e.g., "first", "second") instead of cardinal numbers.src/fraction.ts:50
output?| "numeric" | "alphabetic" | "hybrid" | Numbering["output"]'alphabetic'Output format for the number representation.src/fraction.ts:14
precision?Numbering["precision"]9Precision for decimal/fraction conversion.src/fraction.ts:44
shift?Numbering["shift"]undefinedWhether to shift the fractional part of the number.src/fraction.ts:56
tolerance?Numbering["tolerance"]0.01Tolerance for floating-point comparison when converting decimals to fractions.src/fraction.ts:32