Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 15aca5e

Browse files
committed
Changed casing of the values of config options number and matrix to match the actual name of the classes.
1 parent 67fcde9 commit 15aca5e

73 files changed

Lines changed: 200 additions & 137 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

HISTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
the entries, improving performance.
3535
- Implemented nearly equal comparison for relational functions (`equal`,
3636
`larger`, `smaller`, etc.) when using BigNumbers.
37+
- Changed the casing of the configuration options `matrix` (`Array` or `Matrix`)
38+
and `number` (`number`, `BigNumber`, `Fraction`) such that they now match
39+
the type returned by `math.typeof`. Wrong casing gives a console warning but
40+
will still work.
3741
- Changed the default config value for `epsilon` from `1e-14` to `1e-12`,
3842
see #561.
3943

docs/core/configuration.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Math.js contains a number of configuration options. There are two ways to
44
configure math.js:
55

66
- Configure an existing instance of math.js using `math.config(options)`,
7-
for example `math.config({number: 'bignumber'})` to change to BigNumbers.
7+
for example `math.config({number: 'BigNumber'})` to change to BigNumbers.
88
- Create and configure a new instance of math.js using `math.create([options])`,
9-
for example `var bigmath = math.create({number: 'bignumber'})` to create a new
9+
for example `var bigmath = math.create({number: 'BigNumber'})` to create a new
1010
instance configured to use BigNumbers.
1111

1212
The following configuration options are available:
@@ -16,7 +16,7 @@ The following configuration options are available:
1616
Default value is `1e-14`.
1717

1818
- `matrix`. The default type of matrix output for functions.
19-
Available values are: `'matrix'` (default) or `'array'`.
19+
Available values are: `'Matrix'` (default) or `'Array'`.
2020
Where possible, the type of matrix output from functions is determined from
2121
the function input: An array as input will return an Array, a Matrix as input
2222
will return a Matrix. In case of no matrix as input, the type of output is
@@ -28,7 +28,7 @@ The following configuration options are available:
2828
functions input. For most functions though, the type of output is determined
2929
from the the input: a number as input will return a number as output,
3030
a BigNumber as input returns a BigNumber as output.
31-
Available values are: `'number'` (default), `'bignumber'`, or `'fraction'`.
31+
Available values are: `'number'` (default), `'BigNumber'`, or `'Fraction'`.
3232
[BigNumbers](../datatypes/bignumbers.js) have higher precision than the default
3333
numbers of JavaScript, and [`Fractions`](../datatypes/fractions.js) store
3434
values in terms of a numerator and denominator.
@@ -62,24 +62,24 @@ math.range(0, 4); // Matrix [0, 1, 2, 3]
6262

6363
// create a new instance configured to use Arrays
6464
var math2 = math.create({
65-
matrix: 'array' // Choose 'matrix' (default) or 'array'
65+
matrix: 'Array' // Choose 'Matrix' (default) or 'Array'
6666
});
6767

6868
// range will output an Array
6969
math2.range(0, 4); // Array [0, 1, 2, 3]
7070

7171
// change the configuration of math2 from Arrays to Matrices
7272
math2.config({
73-
matrix: 'matrix' // Choose 'matrix' (default) or 'array'
73+
matrix: 'Matrix' // Choose 'Matrix' (default) or 'Array'
7474
});
7575

7676
// range will output a Matrix
7777
math2.range(0, 4); // Matrix [0, 1, 2, 3]
7878

7979

80-
// create an instance of math.js with bignumber configuration
80+
// create an instance of math.js with BigNumber configuration
8181
var bigmath = math.create({
82-
number: 'bignumber', // Choose 'number' (default), 'bignumber', or 'fraction'
82+
number: 'BigNumber', // Choose 'number' (default), 'BigNumber', or 'Fraction'
8383
precision: 32 // 64 by default, only applicable for BigNumbers
8484
});
8585

@@ -105,15 +105,15 @@ bigmath.eval('1 / 3'); // BigNumber, 0.33333333333333333333333333333333
105105
106106
// change the configuration of math from Matrices to Arrays
107107
math.config({
108-
matrix: 'array' // Choose 'matrix' (default) or 'array'
108+
matrix: 'Array' // Choose 'Matrix' (default) or 'Array'
109109
});
110110
111111
// range will output an Array
112112
math.range(0, 4); // Array [0, 1, 2, 3]
113113
114114
// create a new instance of math.js with bignumber configuration
115115
var bigmath = math.create({
116-
number: 'bignumber', // Choose 'number' (default), 'bignumber', or 'fraction'
116+
number: 'BigNumber', // Choose 'number' (default), 'BigNumber', or 'Fraction'
117117
precision: 32 // 64 by default, only applicable for BigNumbers
118118
});
119119

docs/datatypes/bignumbers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ BigNumbers instead of [numbers](numbers.md) by default, configure math.js like:
2121

2222
```js
2323
math.config({
24-
number: 'bignumber', // Default type of number:
25-
// 'number' (default), 'bignumber', or 'fraction'
24+
number: 'BigNumber', // Default type of number:
25+
// 'number' (default), 'BigNumber', or 'Fraction'
2626
precision: 64 // Number of significant digits for BigNumbers
2727
});
2828

docs/datatypes/fractions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ which can be configured when instantiating math.js. To configure the use of
3636
fractions instead of [numbers](numbers.md) by default, configure math.js like:
3737

3838
```js
39-
// Configure the default type of number: 'number' (default), 'bignumber', or 'fraction'
39+
// Configure the default type of number: 'number' (default), 'BigNumber', or 'Fraction'
4040
math.config({
41-
number: 'fraction'
41+
number: 'Fraction'
4242
});
4343

4444
// use the expression parser

docs/datatypes/matrices.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function input: An `Array` as input will return an `Array`, a `Matrix` as input
2222
will return a `Matrix`. In case of mixed input, a `Matrix` is returned.
2323
For functions where the type of output cannot be determined from the
2424
input, the output is determined by the configuration option `matrix`,
25-
which can be a string `'matrix'` (default) or `'array'`.
25+
which can be a string `'Matrix'` (default) or `'Array'`.
2626

2727
```js
2828
// create an array and a matrix

docs/datatypes/numbers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ can be configured when instantiating math.js:
2020
```js
2121
math.config({
2222
number: 'number' // Default type of number:
23-
// 'number' (default), 'bignumber', or 'fraction'
23+
// 'number' (default), 'BigNumber', or 'Fraction'
2424
});
2525
```
2626

docs/expressions/syntax.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ The default number type of the expression parser can be changed at instantiation
275275
of math.js. The expression parser parses numbers as BigNumber by default:
276276

277277
```js
278-
// Configure the type of number: 'number' (default), 'bignumber', or 'fraction'
279-
math.config({number: 'bignumber'});
278+
// Configure the type of number: 'number' (default), 'BigNumber', or 'Fraction'
279+
math.config({number: 'BigNumber'});
280280

281281
// all numbers are parsed as BigNumber
282282
math.eval('0.1 + 0.2'); // BigNumber, 0.3

docs/reference/functions/config.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ math.config(config: Object): Object
1414

1515
Parameter | Type | Description
1616
--------- | ---- | -----------
17-
`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) or 'bignumber' {number} precision The number of significant digits for BigNumbers. Not applicable for Numbers. {string} parenthesis How to display parentheses in LaTeX and string output.
17+
`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) or 'BigNumber' {number} precision The number of significant digits for BigNumbers. Not applicable for Numbers. {string} parenthesis How to display parentheses in LaTeX and string output.
1818

1919
### Returns
2020

@@ -28,7 +28,7 @@ Object | Returns the current configuration
2828
```js
2929
math.config().number; // outputs 'number'
3030
math.eval('0.4'); // outputs number 0.4
31-
math.config({number: 'fraction'});
31+
math.config({number: 'Fraction'});
3232
math.eval('0.4'); // outputs Fraction 2/5
3333
```
3434

examples/advanced/convert_fraction_to_bignumber.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var core = require('../../core');
1616
var math = core.create();
1717

1818
// Configure to use fractions by default
19-
math.config({number: 'fraction'});
19+
math.config({number: 'Fraction'});
2020

2121
// Add a conversion from Faction -> BigNumber
2222
// this conversion:

examples/bignumbers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ var math = require('../index');
55

66
// configure the default type of numbers as BigNumbers
77
math.config({
8-
number: 'bignumber', // Default type of number:
9-
// 'number' (default), 'bignumber', or 'fraction'
8+
number: 'BigNumber', // Default type of number:
9+
// 'number' (default), 'BigNumber', or 'Fraction'
1010
precision: 20 // Number of significant digits for BigNumbers
1111
});
1212

0 commit comments

Comments
 (0)