UNPKG

1.47 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function config
4
5Set configuration options for math.js, and get current options.
6Will emit a 'config' event, with arguments (curr, prev, changes).
7
8This function is only available on a mathjs instance created using `create`.
9
10
11## Syntax
12
13```js
14math.config(config: Object): Object
15```
16
17### Parameters
18
19Parameter | Type | Description
20--------- | ---- | -----------
21`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.
22
23### Returns
24
25Type | Description
26---- | -----------
27Object | Returns the current configuration
28
29
30## Examples
31
32```js
33import { create, all } from 'mathjs'
34
35// create a mathjs instance
36const math = create(all)
37
38math.config().number // outputs 'number'
39math.evaluate('0.4') // outputs number 0.4
40math.config({number: 'Fraction'})
41math.evaluate('0.4') // outputs Fraction 2/5
42```
43
44