mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
1.4 KiB
1.4 KiB
| layout |
|---|
| default |
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]);