mirror of
https://github.com/MikeMcl/decimal.js.git
synced 2025-06-10 03:14:23 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
19c6406500
@ -1,6 +1,8 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "node"
|
||||
- "14"
|
||||
- "13"
|
||||
- "12"
|
||||
- "11"
|
||||
- "10"
|
||||
|
@ -1,3 +1,7 @@
|
||||
#### 10.2.1
|
||||
* 28/09/2020
|
||||
* Correct `sqrt` initial estimate.
|
||||
|
||||
#### 10.2.0
|
||||
* 08/05/2019
|
||||
* #128 Workaround V8 `Math.pow` change.
|
||||
|
@ -1,6 +1,6 @@
|
||||
The MIT Licence.
|
||||
|
||||
Copyright (c) 2019 Michael Mclaughlin
|
||||
Copyright (c) 2020 Michael Mclaughlin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
21
README.md
21
README.md
@ -2,6 +2,8 @@
|
||||
|
||||
An arbitrary-precision Decimal type for JavaScript.
|
||||
|
||||
[](https://www.npmjs.com/package/decimal.js)
|
||||
[](https://www.npmjs.com/package/decimal.js)
|
||||
[](https://travis-ci.org/MikeMcl/decimal.js)
|
||||
[](https://cdnjs.com/libraries/decimal.js)
|
||||
|
||||
@ -16,7 +18,7 @@ An arbitrary-precision Decimal type for JavaScript.
|
||||
- Faster, smaller, and perhaps easier to use than JavaScript versions of Java's BigDecimal
|
||||
- No dependencies
|
||||
- Wide platform compatibility: uses JavaScript 1.5 (ECMAScript 3) features only
|
||||
- Comprehensive [documentation](http://mikemcl.github.io/decimal.js/) and test set
|
||||
- Comprehensive [documentation](https://mikemcl.github.io/decimal.js/) and test set
|
||||
- Includes a TypeScript declaration file: *decimal.d.ts*
|
||||
|
||||

|
||||
@ -34,7 +36,7 @@ For a lighter version of this library without the trigonometric functions see [d
|
||||
|
||||
## Load
|
||||
|
||||
The library is the single JavaScript file *decimal.js* (or minified, *decimal.min.js*).
|
||||
The library is the single JavaScript file *decimal.js* or ES module *decimal.mjs*.
|
||||
|
||||
Browser:
|
||||
|
||||
@ -42,24 +44,31 @@ Browser:
|
||||
<script src='path/to/decimal.js'></script>
|
||||
```
|
||||
|
||||
[Node.js](http://nodejs.org):
|
||||
```html
|
||||
<script type="module">
|
||||
import Decimal from './path/to/decimal.mjs';
|
||||
...
|
||||
</script>
|
||||
```
|
||||
|
||||
[Node.js](https://nodejs.org):
|
||||
|
||||
```bash
|
||||
$ npm install --save decimal.js
|
||||
$ npm install decimal.js
|
||||
```
|
||||
|
||||
```js
|
||||
var Decimal = require('decimal.js');
|
||||
```
|
||||
|
||||
ES6 module (*decimal.mjs*):
|
||||
ES module:
|
||||
|
||||
```js
|
||||
//import Decimal from 'decimal.js';
|
||||
import {Decimal} from 'decimal.js';
|
||||
```
|
||||
|
||||
AMD loader libraries such as [requireJS](http://requirejs.org/):
|
||||
AMD loader libraries such as [requireJS](https://requirejs.org/):
|
||||
|
||||
```js
|
||||
require(['decimal'], function(Decimal) {
|
||||
|
@ -3,10 +3,10 @@
|
||||
|
||||
|
||||
/*
|
||||
* decimal.js v10.2.0
|
||||
* decimal.js v10.2.1
|
||||
* An arbitrary-precision Decimal type for JavaScript.
|
||||
* https://github.com/MikeMcl/decimal.js
|
||||
* Copyright (c) 2019 Michael Mclaughlin <M8ch88l@gmail.com>
|
||||
* Copyright (c) 2020 Michael Mclaughlin <M8ch88l@gmail.com>
|
||||
* MIT Licence
|
||||
*/
|
||||
|
||||
@ -1787,7 +1787,7 @@
|
||||
e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
|
||||
|
||||
if (s == 1 / 0) {
|
||||
n = '1e' + e;
|
||||
n = '5e' + e;
|
||||
} else {
|
||||
n = s.toExponential();
|
||||
n = n.slice(0, n.indexOf('e') + 1) + e;
|
||||
|
3
decimal.min.js
vendored
3
decimal.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,8 +1,8 @@
|
||||
/*
|
||||
* decimal.js v10.2.0
|
||||
* decimal.js v10.2.1
|
||||
* An arbitrary-precision Decimal type for JavaScript.
|
||||
* https://github.com/MikeMcl/decimal.js
|
||||
* Copyright (c) 2019 Michael Mclaughlin <M8ch88l@gmail.com>
|
||||
* Copyright (c) 2020 Michael Mclaughlin <M8ch88l@gmail.com>
|
||||
* MIT Licence
|
||||
*/
|
||||
|
||||
@ -1724,7 +1724,7 @@ P.squareRoot = P.sqrt = function () {
|
||||
e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
|
||||
|
||||
if (s == 1 / 0) {
|
||||
n = '1e' + e;
|
||||
n = '5e' + e;
|
||||
} else {
|
||||
n = s.toExponential();
|
||||
n = n.slice(0, n.indexOf('e') + 1) + e;
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "decimal.js",
|
||||
"description": "An arbitrary-precision Decimal type for JavaScript.",
|
||||
"version": "10.2.0",
|
||||
"version": "10.2.1",
|
||||
"keywords": [
|
||||
"arbitrary",
|
||||
"precision",
|
||||
|
Loading…
Reference in New Issue
Block a user