mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
Updated to decimal.js v5.0.4
This commit is contained in:
parent
73cb353260
commit
c65e486e6e
@ -1,9 +1,7 @@
|
||||
var Decimal = require('decimal.js');
|
||||
|
||||
function factory (type, config, load, typed, math) {
|
||||
//var BigNumber = Decimal.clone(config); // TODO: use this shorter notation after https://github.com/MikeMcl/decimal.js/issues/26 is fixed
|
||||
var BigNumber = Decimal.clone();
|
||||
BigNumber.config(config);
|
||||
var BigNumber = Decimal.clone({precision: config.precision});
|
||||
|
||||
/**
|
||||
* Attach type information
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
"unit"
|
||||
],
|
||||
"dependencies": {
|
||||
"decimal.js": "5.0.3",
|
||||
"decimal.js": "5.0.4",
|
||||
"fraction.js": "3.2.5",
|
||||
"complex.js": "1.9.6",
|
||||
"tiny-emitter": "1.0.2",
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
// test bignumber utils
|
||||
var assert = require('assert');
|
||||
var BigNumber = require('decimal.js');
|
||||
var Big32 = BigNumber.clone();
|
||||
Big32.config({precision: 32});
|
||||
var Big64 = BigNumber.clone();
|
||||
Big64.config({precision: 64});
|
||||
var Big32 = BigNumber.clone({precision: 32});
|
||||
var Big64 = BigNumber.clone({precision: 64});
|
||||
var constants = require('../../../lib/utils/bignumber/constants');
|
||||
|
||||
describe('bignumber', function() {
|
||||
|
||||
@ -9,8 +9,7 @@ describe('format', function () {
|
||||
var B = null;
|
||||
|
||||
before (function () {
|
||||
B = BigNumber.clone();
|
||||
B.config({precision: 20}); // ensure the precision is 20 digits
|
||||
B = BigNumber.clone({precision: 20}); // ensure the precision is 20 digits
|
||||
});
|
||||
|
||||
it ('should format special values Infinity, NaN', function () {
|
||||
@ -142,8 +141,7 @@ describe('format', function () {
|
||||
});
|
||||
|
||||
it('should format bignumbers with custom precision, lower, and upper bound', function() {
|
||||
var Big = BigNumber.clone();
|
||||
Big.config({precision: 100});
|
||||
var Big = BigNumber.clone({precision: 100});
|
||||
|
||||
var options = {
|
||||
notation: 'auto',
|
||||
@ -219,8 +217,7 @@ describe('format', function () {
|
||||
});
|
||||
|
||||
it('should format a bignumber using toFixed', function() {
|
||||
var Big = BigNumber.clone();
|
||||
Big.config({precision: 100});
|
||||
var Big = BigNumber.clone({precision: 100});
|
||||
|
||||
assert.equal(formatter.toFixed(new Big(2.34)), '2');
|
||||
assert.equal(formatter.toFixed(new Big(2.34), 1), '2.3');
|
||||
@ -231,8 +228,7 @@ describe('format', function () {
|
||||
});
|
||||
|
||||
it('should format a bignumber using toExponential', function() {
|
||||
var Big = BigNumber.clone();
|
||||
Big.config({precision: 100});
|
||||
var Big = BigNumber.clone({precision: 100});
|
||||
|
||||
assert.equal(formatter.toExponential(new Big(2.34)), '2.34e+0');
|
||||
assert.equal(formatter.toExponential(new Big(2.34e+3)), '2.34e+3');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user