UNPKG

1.84 kBJavaScriptView Raw
1'use strict';
2
3var _core = require('./core/core');
4
5var _core2 = _interopRequireDefault(_core);
6
7function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
9/**
10 * math.js factory function. Creates a new instance of math.js
11 *
12 * @param {Object} [config] Available configuration options:
13 * {number} epsilon
14 * Minimum relative difference between two
15 * compared values, used by all comparison functions.
16 * {string} matrix
17 * A string 'matrix' (default) or 'array'.
18 * {string} number
19 * A string 'number' (default), 'bignumber', or
20 * 'fraction'
21 * {number} precision
22 * The number of significant digits for BigNumbers.
23 * Not applicable for Numbers.
24 * {boolean} predictable
25 * Predictable output type of functions. When true,
26 * output type depends only on the input types. When
27 * false (default), output type can vary depending
28 * on input values. For example `math.sqrt(-4)`
29 * returns `complex('2i')` when predictable is false, and
30 * returns `NaN` when true.
31 */
32function create(config) {
33 // create a new math.js instance
34 var math = _core2.default.create(config);
35 math.create = create;
36
37 // import data types, functions, constants, expression parser, etc.
38 math['import'](require('./index'));
39
40 return math;
41}
42
43// return a new instance of math.js
44module.exports = create();
\No newline at end of file