1
0
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:
thefantas 2021-03-26 17:54:34 +03:00
commit 19c6406500
9 changed files with 31 additions and 17 deletions

View File

@ -1,6 +1,8 @@
language: node_js
node_js:
- "node"
- "14"
- "13"
- "12"
- "11"
- "10"

View File

@ -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.

View File

@ -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

View File

@ -2,6 +2,8 @@
An arbitrary-precision Decimal type for JavaScript.
[![npm version](https://img.shields.io/npm/v/decimal.js.svg)](https://www.npmjs.com/package/decimal.js)
[![npm downloads](https://img.shields.io/npm/dw/decimal.js)](https://www.npmjs.com/package/decimal.js)
[![Build Status](https://travis-ci.org/MikeMcl/decimal.js.svg)](https://travis-ci.org/MikeMcl/decimal.js)
[![CDNJS](https://img.shields.io/cdnjs/v/decimal.js.svg)](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*
![API](https://raw.githubusercontent.com/MikeMcl/decimal.js/gh-pages/API.png)
@ -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) {

View File

@ -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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -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;

View File

@ -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",