1
0
mirror of https://github.com/MikeMcl/decimal.js.git synced 2024-10-27 20:34:12 +00:00
This commit is contained in:
Michael Mclaughlin 2015-02-20 16:01:25 +00:00
parent d136e91d66
commit aaa0794f69
8 changed files with 64 additions and 26 deletions

View File

@ -1,6 +1,8 @@
language: node_js
node_js:
- "0.12"
- "0.11"
- "0.10"
- "0.8"
- "0.6"
- iojs

View File

@ -184,7 +184,7 @@ then
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
@ -204,6 +204,9 @@ See LICENCE.
## Change Log
####4.0.2
* 20/02/2015 Add bower.json. Add source map. Amend travis CI. Amend doc/comments.
####4.0.1
* 11/12/2014 Assign correct constructor when duplicating a Decimal.

35
bower.json Normal file
View 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"
]
}

View File

@ -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) {
'use strict';
/*
* decimal.js v4.0.1
* decimal.js v4.0.2
* An arbitrary-precision Decimal type for JavaScript.
* https://github.com/MikeMcl/decimal.js
* Copyright (c) 2014 Michael Mclaughlin <M8ch88l@gmail.com>
@ -891,20 +891,17 @@
/*
* 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) {
var n = null,
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'] ) {
@ -3682,7 +3679,7 @@
for ( ; i < n; ) {
v = a[i];
// 0 >= v < 4294967296
// 0 <= v < 4294967296
// Probability that v >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
if ( v >= 4.29e9 ) {
@ -3712,7 +3709,7 @@
crypto['randomBytes'](4).copy( a, i );
} else {
// 0 <= v <= 4289999999
// 0 <= v <= 2139999999
// 0 <= ( v % 1e7 ) <= 9999999
r.push( v % 1e7 );
i += 4;

5
decimal.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,7 @@
<html>
<head>
<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">
<title>decimal.js API</title>
<style>
@ -761,7 +761,7 @@ Decimal.config({ toExpPos: 0 })</pre>
</p>
<p>
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>See <a href='#Errors'>Errors</a>.</p>
<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
<code>crypto</code> methods are unavailable.
</p>
</p>
<pre>
Decimal.crypto // false
Decimal.config({ crypto: true })</pre>
@ -864,7 +863,7 @@ Decimal.config({ crypto: true })</pre>
<h5 id="format">format</h5>
<p><i>object</i>
<p><i>object</i></p>
<p>
The <code>format</code> object configures the format of the string returned by the
<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.
</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.
</p>
<p>
@ -1648,7 +1647,7 @@ y.toExponential(3) // '4.560e+1'</pre>
returns exponential notation.
</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.
</p>
<p>
@ -1691,7 +1690,7 @@ y.toFixed(5) // '3.45600'</pre>
not rounded to a fixed number of decimal places.
</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.
</p>
<pre>
@ -1933,7 +1932,7 @@ new Decimal(28).pow('6.166675020000903537297764507632802193308677149')
the same as <code><a href='#toS'>toString</a></code>.
</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.
</p>
<p>
@ -1970,7 +1969,7 @@ y.toPrecision(5) // '45.600'</pre>
be rounded to <a href='#precision'><code>precision</code></a> significant digits.
</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.
</p>
<p>

1
doc/decimal.js.map Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
{
"name": "decimal.js",
"description": "An arbitrary-precision Decimal type for JavaScript.",
"version": "4.0.1",
"version": "4.0.2",
"keywords": [
"arbitrary",
"precision",
@ -31,6 +31,6 @@
"license": "MIT",
"scripts": {
"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 */\""
}
}