2019-06-08 20:55:59 +02:00

49 lines
1.8 KiB
Markdown

---
layout: default
---
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
<h1 id="function-config">Function config <a href="#function-config" title="Permalink">#</a></h1>
Set configuration options for math.js, and get current options.
Will emit a 'config' event, with arguments (curr, prev, changes).
This function is only available on a mathjs instance created using `create`.
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
```js
math.config(config: Object): Object
```
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
Parameter | Type | Description
--------- | ---- | -----------
`options` | Object | Available options: {number} epsilon Minimum relative difference between two compared values, used by all comparison functions. {string} matrix A string 'Matrix' (default) or 'Array'. {string} number A string 'number' (default), 'BigNumber', or 'Fraction' {number} precision The number of significant digits for BigNumbers. Not applicable for Numbers. {string} parenthesis How to display parentheses in LaTeX and string output. {string} randomSeed Random seed for seeded pseudo random number generator. Set to null to randomly seed.
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
Type | Description
---- | -----------
Object | Returns the current configuration
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
```js
import { create, all } from 'mathjs'
// create a mathjs instance
const math = create(all)
math.config().number // outputs 'number'
math.evaluate('0.4') // outputs number 0.4
math.config({number: 'Fraction'})
math.evaluate('0.4') // outputs Fraction 2/5
```