mirror of
https://github.com/MikeMcl/decimal.js.git
synced 2024-10-27 20:34:12 +00:00
v4.0.2
This commit is contained in:
parent
d136e91d66
commit
aaa0794f69
@ -1,6 +1,8 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
|
- "0.12"
|
||||||
- "0.11"
|
- "0.11"
|
||||||
- "0.10"
|
- "0.10"
|
||||||
- "0.8"
|
- "0.8"
|
||||||
- "0.6"
|
- "0.6"
|
||||||
|
- iojs
|
||||||
|
@ -184,7 +184,7 @@ then
|
|||||||
|
|
||||||
will create *decimal.min.js*.
|
will create *decimal.min.js*.
|
||||||
|
|
||||||
The *decimal.min.js* already present was created with *Microsoft Ajax Minifier 5.11*.
|
A source map will also be created in the *doc* directory.
|
||||||
|
|
||||||
## Feedback
|
## Feedback
|
||||||
|
|
||||||
@ -204,6 +204,9 @@ See LICENCE.
|
|||||||
|
|
||||||
## Change Log
|
## Change Log
|
||||||
|
|
||||||
|
####4.0.2
|
||||||
|
* 20/02/2015 Add bower.json. Add source map. Amend travis CI. Amend doc/comments.
|
||||||
|
|
||||||
####4.0.1
|
####4.0.1
|
||||||
* 11/12/2014 Assign correct constructor when duplicating a Decimal.
|
* 11/12/2014 Assign correct constructor when duplicating a Decimal.
|
||||||
|
|
||||||
|
35
bower.json
Normal file
35
bower.json
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"name": "decimal.js",
|
||||||
|
"main": "decimal.js",
|
||||||
|
"version": "4.0.2",
|
||||||
|
"homepage": "https://github.com/MikeMcl/decimal.js",
|
||||||
|
"authors": [
|
||||||
|
"Michael Mclaughlin <M8ch88l@gmail.com>"
|
||||||
|
],
|
||||||
|
"description": "An arbitrary-precision Decimal type for JavaScript",
|
||||||
|
"moduleType": [
|
||||||
|
"amd",
|
||||||
|
"globals",
|
||||||
|
"node"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"arbitrary",
|
||||||
|
"precision",
|
||||||
|
"arithmetic",
|
||||||
|
"bignumber",
|
||||||
|
"decimal",
|
||||||
|
"float",
|
||||||
|
"biginteger",
|
||||||
|
"bigdecimal",
|
||||||
|
"bignum",
|
||||||
|
"math"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"ignore": [
|
||||||
|
".*",
|
||||||
|
"doc",
|
||||||
|
"test",
|
||||||
|
"package.json"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
19
decimal.js
19
decimal.js
@ -1,10 +1,10 @@
|
|||||||
/*! decimal.js v4.0.1 https://github.com/MikeMcl/decimal.js/LICENCE */
|
/*! decimal.js v4.0.2 https://github.com/MikeMcl/decimal.js/LICENCE */
|
||||||
;(function (global) {
|
;(function (global) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* decimal.js v4.0.1
|
* decimal.js v4.0.2
|
||||||
* An arbitrary-precision Decimal type for JavaScript.
|
* An arbitrary-precision Decimal type for JavaScript.
|
||||||
* https://github.com/MikeMcl/decimal.js
|
* https://github.com/MikeMcl/decimal.js
|
||||||
* Copyright (c) 2014 Michael Mclaughlin <M8ch88l@gmail.com>
|
* Copyright (c) 2014 Michael Mclaughlin <M8ch88l@gmail.com>
|
||||||
@ -891,20 +891,17 @@
|
|||||||
/*
|
/*
|
||||||
* Return the number of significant digits of this Decimal.
|
* Return the number of significant digits of this Decimal.
|
||||||
*
|
*
|
||||||
* z {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
|
* [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
P['precision'] = P['sd'] = function (z) {
|
P['precision'] = P['sd'] = function (z) {
|
||||||
var n = null,
|
var n = null,
|
||||||
x = this;
|
x = this;
|
||||||
|
|
||||||
if ( z != n ) {
|
if ( z != n && z !== !!z && z !== 1 && z !== 0 ) {
|
||||||
|
|
||||||
if ( z !== !!z && z !== 1 && z !== 0 ) {
|
// 'precision() argument not a boolean or binary digit: {z}'
|
||||||
|
ifExceptionsThrow( x['constructor'], 'argument', z, 'precision', 1 );
|
||||||
// 'precision() argument not a boolean or binary digit: {z}'
|
|
||||||
ifExceptionsThrow( x['constructor'], 'argument', z, 'precision', 1 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( x['c'] ) {
|
if ( x['c'] ) {
|
||||||
@ -3682,7 +3679,7 @@
|
|||||||
for ( ; i < n; ) {
|
for ( ; i < n; ) {
|
||||||
v = a[i];
|
v = a[i];
|
||||||
|
|
||||||
// 0 >= v < 4294967296
|
// 0 <= v < 4294967296
|
||||||
// Probability that v >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
|
// Probability that v >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
|
||||||
if ( v >= 4.29e9 ) {
|
if ( v >= 4.29e9 ) {
|
||||||
|
|
||||||
@ -3712,7 +3709,7 @@
|
|||||||
crypto['randomBytes'](4).copy( a, i );
|
crypto['randomBytes'](4).copy( a, i );
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// 0 <= v <= 4289999999
|
// 0 <= v <= 2139999999
|
||||||
// 0 <= ( v % 1e7 ) <= 9999999
|
// 0 <= ( v % 1e7 ) <= 9999999
|
||||||
r.push( v % 1e7 );
|
r.push( v % 1e7 );
|
||||||
i += 4;
|
i += 4;
|
||||||
|
5
decimal.min.js
vendored
5
decimal.min.js
vendored
File diff suppressed because one or more lines are too long
17
doc/API.html
17
doc/API.html
@ -2,7 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="Author" content="MMclaughlin">
|
<meta name="Author" content="MMclaughlin">
|
||||||
<title>decimal.js API</title>
|
<title>decimal.js API</title>
|
||||||
<style>
|
<style>
|
||||||
@ -761,7 +761,7 @@ Decimal.config({ toExpPos: 0 })</pre>
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
The value that determines whether Decimal Errors are thrown.<br />
|
The value that determines whether Decimal Errors are thrown.<br />
|
||||||
If <code>errors</code> is false, this library will not throw errors.
|
If <code>errors</code> is false, no erros will be thrown.
|
||||||
</p>
|
</p>
|
||||||
<p>See <a href='#Errors'>Errors</a>.</p>
|
<p>See <a href='#Errors'>Errors</a>.</p>
|
||||||
<pre>Decimal.config({ errors: false })
|
<pre>Decimal.config({ errors: false })
|
||||||
@ -851,7 +851,6 @@ Decimal.modulo // 9</pre>
|
|||||||
<a href='#errors'><code>errors</code></a> is <code>true</code>, an error will be thrown if the
|
<a href='#errors'><code>errors</code></a> is <code>true</code>, an error will be thrown if the
|
||||||
<code>crypto</code> methods are unavailable.
|
<code>crypto</code> methods are unavailable.
|
||||||
</p>
|
</p>
|
||||||
</p>
|
|
||||||
<pre>
|
<pre>
|
||||||
Decimal.crypto // false
|
Decimal.crypto // false
|
||||||
Decimal.config({ crypto: true })</pre>
|
Decimal.config({ crypto: true })</pre>
|
||||||
@ -864,7 +863,7 @@ Decimal.config({ crypto: true })</pre>
|
|||||||
|
|
||||||
|
|
||||||
<h5 id="format">format</h5>
|
<h5 id="format">format</h5>
|
||||||
<p><i>object</i>
|
<p><i>object</i></p>
|
||||||
<p>
|
<p>
|
||||||
The <code>format</code> object configures the format of the string returned by the
|
The <code>format</code> object configures the format of the string returned by the
|
||||||
<a href='#toFo'><code>toFormat</code></a> method.
|
<a href='#toFo'><code>toFormat</code></a> method.
|
||||||
@ -1558,7 +1557,7 @@ x.times('-a', 16) // '-6'</pre>
|
|||||||
have the same value as this Decimal.
|
have the same value as this Decimal.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
if <code>rm</code> is omitted or is <code>null</code> or undefined, rounding mode
|
If <code>rm</code> is omitted or is <code>null</code> or undefined, rounding mode
|
||||||
<a href='#rounding'><code>rounding</code></a> is used.
|
<a href='#rounding'><code>rounding</code></a> is used.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
@ -1648,7 +1647,7 @@ y.toExponential(3) // '4.560e+1'</pre>
|
|||||||
returns exponential notation.
|
returns exponential notation.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
if <code>rm</code> is omitted or is <code>null</code> or undefined, rounding mode
|
If <code>rm</code> is omitted or is <code>null</code> or undefined, rounding mode
|
||||||
<a href='#rounding'><code>rounding</code></a> is used.
|
<a href='#rounding'><code>rounding</code></a> is used.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
@ -1691,7 +1690,7 @@ y.toFixed(5) // '3.45600'</pre>
|
|||||||
not rounded to a fixed number of decimal places.
|
not rounded to a fixed number of decimal places.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
if <code>rm</code> is omitted or is <code>null</code> or undefined, rounding mode
|
If <code>rm</code> is omitted or is <code>null</code> or undefined, rounding mode
|
||||||
<a href='#rounding'><code>rounding</code></a> is used.
|
<a href='#rounding'><code>rounding</code></a> is used.
|
||||||
</p>
|
</p>
|
||||||
<pre>
|
<pre>
|
||||||
@ -1933,7 +1932,7 @@ new Decimal(28).pow('6.166675020000903537297764507632802193308677149')
|
|||||||
the same as <code><a href='#toS'>toString</a></code>.
|
the same as <code><a href='#toS'>toString</a></code>.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
if <code>rm</code> is omitted or is <code>null</code> or undefined, rounding mode
|
If <code>rm</code> is omitted or is <code>null</code> or undefined, rounding mode
|
||||||
<a href='#rounding'><code>rounding</code></a> is used.
|
<a href='#rounding'><code>rounding</code></a> is used.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
@ -1970,7 +1969,7 @@ y.toPrecision(5) // '45.600'</pre>
|
|||||||
be rounded to <a href='#precision'><code>precision</code></a> significant digits.
|
be rounded to <a href='#precision'><code>precision</code></a> significant digits.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
if <code>rm</code> is omitted or is <code>null</code> or undefined, rounding mode
|
If <code>rm</code> is omitted or is <code>null</code> or undefined, rounding mode
|
||||||
<a href='#rounding'><code>rounding</code></a> will be used.
|
<a href='#rounding'><code>rounding</code></a> will be used.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
1
doc/decimal.js.map
Normal file
1
doc/decimal.js.map
Normal file
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "decimal.js",
|
"name": "decimal.js",
|
||||||
"description": "An arbitrary-precision Decimal type for JavaScript.",
|
"description": "An arbitrary-precision Decimal type for JavaScript.",
|
||||||
"version": "4.0.1",
|
"version": "4.0.2",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"arbitrary",
|
"arbitrary",
|
||||||
"precision",
|
"precision",
|
||||||
@ -31,6 +31,6 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node ./test/every-test.js",
|
"test": "node ./test/every-test.js",
|
||||||
"build": "uglifyjs decimal.js -c -m -o decimal.min.js --preamble '/* decimal.js v4.0.1 https://github.com/MikeMcl/decimal.js/LICENCE */'"
|
"build": "uglifyjs decimal.js --source-map doc/decimal.js.map -c -m -o decimal.min.js --preamble \"/* decimal.js v4.0.2 https://github.com/MikeMcl/decimal.js/LICENCE */\""
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user