forked from josdejong/mathjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
38 lines (34 loc) · 1.63 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var core = require('./core');
/**
* math.js factory function. Creates a new instance of math.js
*
* @param {Object} [config] Available configuration 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.
* {boolean} predictable
* Predictable output type of functions. When true,
* output type depends only on the input types. When
* false (default), output type can vary depending
* on input values. For example `math.sqrt(-2)`
* returns `NaN` when predictable is false, and
* returns `complex('2i')` when true.
*/
function create (config) {
// create a new math.js instance
var math = core.create(config);
math.create = create;
// import data types, functions, constants, expression parser, etc.
math['import'](require('./lib'));
return math;
}
// return a new instance of math.js
module.exports = create();