46 lines
1009 B
Markdown
46 lines
1009 B
Markdown
|
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
||
|
|
||
|
# Function fraction
|
||
|
|
||
|
Create a fraction convert a value to a fraction.
|
||
|
|
||
|
|
||
|
## Syntax
|
||
|
|
||
|
```js
|
||
|
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
|
||
|
|
||
|
```js
|
||
|
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](bignumber.md),
|
||
|
[number](number.md),
|
||
|
[string](string.md),
|
||
|
[unit](unit.md)
|