simple-squiggle/node_modules/mathjs/docs/reference/functions/fraction.md

1009 B

Function fraction

Create a fraction convert a value to a fraction.

Syntax

math.fraction(numerator, denominator)
math.fraction({n: numerator, d: denominator})
math.fraction(matrix: Array | Matrix)         Turn all matrix entries
                                              into fractions

Parameters

Parameter Type Description
args number | string | Fraction | BigNumber | Array | Matrix Arguments specifying the numerator and denominator of the fraction

Returns

Type Description
Fraction | Array | Matrix Returns a fraction

Examples

math.fraction(1, 3)
math.fraction('2/3')
math.fraction({n: 2, d: 3})
math.fraction([0.2, 0.25, 1.25])

See also

bignumber, number, string, unit