UNPKG

1.01 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function fraction
4
5Create a fraction convert a value to a fraction.
6
7
8## Syntax
9
10```js
11math.fraction(numerator, denominator)
12math.fraction({n: numerator, d: denominator})
13math.fraction(matrix: Array | Matrix) Turn all matrix entries
14 into fractions
15```
16
17### Parameters
18
19Parameter | Type | Description
20--------- | ---- | -----------
21`args` | number &#124; string &#124; Fraction &#124; BigNumber &#124; Array &#124; Matrix | Arguments specifying the numerator and denominator of the fraction
22
23### Returns
24
25Type | Description
26---- | -----------
27Fraction &#124; Array &#124; Matrix | Returns a fraction
28
29
30## Examples
31
32```js
33math.fraction(1, 3)
34math.fraction('2/3')
35math.fraction({n: 2, d: 3})
36math.fraction([0.2, 0.25, 1.25])
37```
38
39
40## See also
41
42[bignumber](bignumber.md),
43[number](number.md),
44[string](string.md),
45[unit](unit.md)