@ztimson/utils / math
math
Functions
dec2Frac()
dec2Frac(num
): string
Convert decimal number to fraction
Parameters
• num: number
Number to convert
Returns
string
Fraction with remainder
Example
dec2Frac(1.25) // Outputs: "1 1/4"
Defined in
src/math.ts:12
fracToDec()
fracToDec(frac
): number
Convert fraction to decimal number
Parameters
• frac: string
Fraction to convert
Returns
number
Faction as a decimal
Example
fracToDec('1 1/4') // Outputs: 1.25
Defined in
src/math.ts:40