<!-- 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 &#124; string &#124; Fraction &#124; BigNumber &#124; Array &#124; Matrix |  Arguments specifying the numerator and denominator of the fraction

### Returns

Type | Description
---- | -----------
Fraction &#124; Array &#124; 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)
