diff --git a/test/browser/every-test.html b/test/browser/every-test.html
index 70702de..57c86c9 100644
--- a/test/browser/every-test.html
+++ b/test/browser/every-test.html
@@ -21,6 +21,7 @@
'cmp',
'config',
'div',
+ 'dp',
'floor',
'minus',
'mod',
diff --git a/test/browser/single-test.html b/test/browser/single-test.html
index d51da42..05462f8 100644
--- a/test/browser/single-test.html
+++ b/test/browser/single-test.html
@@ -14,6 +14,7 @@
+
diff --git a/test/dp.js b/test/dp.js
new file mode 100644
index 0000000..7bb7d66
--- /dev/null
+++ b/test/dp.js
@@ -0,0 +1,94 @@
+var count = (function dp(BigNumber) {
+ var start = +new Date(),
+ log,
+ error,
+ passed = 0,
+ total = 0;
+
+ if (typeof window === 'undefined') {
+ log = console.log;
+ error = console.error;
+ } else {
+ log = function (str) { document.body.innerHTML += str.replace('\n', '
') };
+ error = function (str) { document.body.innerHTML += '
' +
+ str.replace('\n', '
') + '
' };
+ }
+
+ if (!BigNumber && typeof require === 'function') BigNumber = require('../bignumber');
+
+ function assert(expected, actual) {
+ total++;
+ if (expected !== actual) {
+ error('\n Test number: ' + total + ' failed');
+ error(' Expected: ' + expected);
+ error(' Actual: ' + actual);
+ //process.exit();
+ }
+ else {
+ passed++;
+ //log('\n Expected and actual: ' + actual);
+ }
+ }
+
+ function T(value, dp){
+ assert(dp, new BigNumber(value).decimalPlaces());
+ assert(dp, new BigNumber(value).dp());
+ }
+
+ log('\n Testing dp...');
+
+ BigNumber.config({
+ DECIMAL_PLACES : 20,
+ ROUNDING_MODE : 4,
+ ERRORS : true,
+ RANGE : 1E9,
+ EXPONENTIAL_AT : [-7, 21]
+ });
+
+ T(0, 0);
+ T(1, 0);
+ T(1.2, 1);
+ T(0.1, 1);
+ T(0.25, 2);
+ T(0.0625, 4);
+ T(99, 0);
+ T(9900, 0);
+ T(1000.001, 3);
+ T('1000.001', 3);
+ T(-0, 0);
+ T(-1, 0);
+ T(-1.2, 1);
+ T(-0.1, 1);
+ T(-0.25, 2);
+ T(-0.0625, 4);
+ T(-99, 0);
+ T(-9900, 0);
+ T(-1000.001, 3);
+ T('-1000.001', 3);
+
+ T(NaN, null);
+ T('NaN', null);
+ T(Infinity, null);
+ T(-Infinity, null);
+ T('Infinity', null);
+ T('-Infinity', null);
+
+ T('0.00000000000000000002', 20);
+ T('100.0000000000000000000000000000000000032948', 40);
+ T('1.3e-11', 12);
+ T('-3.52e-7', 9);
+ T('6.9525e-12', 16);
+ T('2.1e-8', 9);
+ T('3.7015e-7', 11);
+ T('-50.1839', 4);
+ T('0.014836', 6);
+ T('-16688', 0);
+ T('-506006218906684823229.56892808849303', 14);
+ T('10000000000000.00000000000000000000000000000000000001000000000000000000000000000000000000000001', 80);
+ T('057643758687043658032465987410000000000000.0000000000000', 0);
+ T('999999999999999999999999999999999999999999999999999999999999999999999999999.99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999', 113);
+
+ log('\n ' + passed + ' of ' + total + ' tests passed in ' + (+new Date() - start) + ' ms \n');
+ return [passed, total];;
+})(this.BigNumber);
+if (typeof module !== 'undefined' && module.exports) module.exports = count;
\ No newline at end of file
diff --git a/test/every-test.js b/test/every-test.js
index 754e702..b1cf48d 100644
--- a/test/every-test.js
+++ b/test/every-test.js
@@ -12,6 +12,7 @@ console.log( '\n STARTING TESTS...\n' );
'ceil',
'cmp',
'config',
+ 'dp',
'div',
'floor',
'minus',