mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
New configuration option 'parenthesis'
This option can be one of 'keep', 'auto' or 'all'
This commit is contained in:
parent
ea04373028
commit
5b8bb06804
@ -17,6 +17,9 @@ function factory (type, config, load, typed, math) {
|
||||
* {number} precision
|
||||
* The number of significant digits for BigNumbers.
|
||||
* Not applicable for Numbers.
|
||||
* {string} parenthesis
|
||||
* How to display parentheses in LaTeX and String
|
||||
* output.
|
||||
* @return {Object} Returns the current configuration
|
||||
*/
|
||||
return function _config(options) {
|
||||
|
||||
@ -19,6 +19,9 @@ var configFactory = require('./config');
|
||||
* {number} precision
|
||||
* The number of significant digits for BigNumbers.
|
||||
* Not applicable for Numbers.
|
||||
* {string} parenthesis
|
||||
* How to display parentheses in LaTeX and String
|
||||
* output.
|
||||
* @returns {Object} Returns a bare-bone math.js instance containing
|
||||
* functions:
|
||||
* - `import` to add new functions
|
||||
@ -57,7 +60,11 @@ exports.create = function create (options) {
|
||||
|
||||
// minimum relative difference between two compared values,
|
||||
// used by all comparison functions
|
||||
epsilon: 1e-14
|
||||
epsilon: 1e-14,
|
||||
|
||||
// which type of parenthesis to use for toString and toTex
|
||||
// one of 'keep', 'auto', and 'all'
|
||||
parenthesis: 'keep'
|
||||
};
|
||||
|
||||
if (options) {
|
||||
|
||||
@ -10,7 +10,8 @@ describe('factory', function() {
|
||||
matrix: 'matrix',
|
||||
number: 'number',
|
||||
precision: 64,
|
||||
epsilon: 1e-14
|
||||
epsilon: 1e-14,
|
||||
parenthesis: 'keep'
|
||||
});
|
||||
});
|
||||
|
||||
@ -25,7 +26,8 @@ describe('factory', function() {
|
||||
matrix: 'array',
|
||||
number: 'bignumber',
|
||||
precision: 64,
|
||||
epsilon: 1e-14
|
||||
epsilon: 1e-14,
|
||||
parenthesis: 'keep'
|
||||
});
|
||||
});
|
||||
|
||||
@ -56,21 +58,24 @@ describe('factory', function() {
|
||||
matrix: 'matrix',
|
||||
number: 'number',
|
||||
precision: 64,
|
||||
epsilon: 1e-14
|
||||
epsilon: 1e-14,
|
||||
parenthesis: 'keep'
|
||||
});
|
||||
|
||||
math1.config({
|
||||
matrix: 'array',
|
||||
number: 'bignumber',
|
||||
precision: 32,
|
||||
epsilon: 1e-7
|
||||
epsilon: 1e-7,
|
||||
parenthesis: 'auto'
|
||||
});
|
||||
|
||||
assert.deepEqual(math1.config(), {
|
||||
matrix: 'array',
|
||||
number: 'bignumber',
|
||||
precision: 32,
|
||||
epsilon: 1e-7
|
||||
epsilon: 1e-7,
|
||||
parenthesis: 'auto'
|
||||
});
|
||||
|
||||
// restore the original config
|
||||
@ -91,4 +96,4 @@ describe('factory', function() {
|
||||
Object.create = create;
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user