Publish v5.10.1

This commit is contained in:
jos 2019-05-17 19:53:36 +02:00
parent 28143eeddf
commit 23ce3fe7a7
28 changed files with 97 additions and 91 deletions

View File

@ -29,7 +29,7 @@ Math.js can be downloaded or linked from various content delivery networks:
<tbody>
<tr>
<td>unpkg</td>
<td><a href="https://unpkg.com/mathjs@5.10.0/">https://unpkg.com/mathjs@5.10.0/</a></td>
<td><a href="https://unpkg.com/mathjs@5.10.1/">https://unpkg.com/mathjs@5.10.1/</a></td>
</tr>
<tr>
<td>cdnjs</td>
@ -47,8 +47,8 @@ Here some direct download links from [unpkg](https://unpkg.com):
<table class="download">
<tr>
<td>
<a href="https://unpkg.com/mathjs@5.10.0/dist/math.js">
Development (version 5.10.0)
<a href="https://unpkg.com/mathjs@5.10.1/dist/math.js">
Development (version 5.10.1)
</a>
</td>
<td>
@ -57,8 +57,8 @@ Here some direct download links from [unpkg](https://unpkg.com):
</tr>
<tr>
<td>
<a href="https://unpkg.com/mathjs@5.10.0/dist/math.min.js">
Production (version 5.10.0)
<a href="https://unpkg.com/mathjs@5.10.1/dist/math.min.js">
Production (version 5.10.1)
</a>
</td>
<td>

View File

@ -14,7 +14,7 @@
}
</style>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
</head>
<body>

View File

@ -23,7 +23,7 @@ File: [angle_configuration.html](angle_configuration.html) (click for a live dem
}
</style>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
</head>
<body>

View File

@ -2,7 +2,7 @@
<html>
<head>
<title>math.js | basic usage</title>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
</head>
<body>

View File

@ -11,7 +11,7 @@ File: [basic_usage.html](basic_usage.html) (click for a live demo)
<html>
<head>
<title>math.js | basic usage</title>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
</head>
<body>

View File

@ -3,7 +3,7 @@
<head>
<title>math.js | currency conversion</title>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
<style>
body,

View File

@ -12,7 +12,7 @@ File: [currency_conversion.html](currency_conversion.html) (click for a live dem
<head>
<title>math.js | currency conversion</title>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
<style>
body,

View File

@ -14,7 +14,7 @@
}
</style>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
</head>
<body>

View File

@ -23,7 +23,7 @@ File: [custom_separators.html](custom_separators.html) (click for a live demo)
}
</style>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
</head>
<body>

View File

@ -7,7 +7,7 @@
<script src="//cdnjs.cloudflare.com/ajax/libs/es5-shim/2.2.0/es5-shim.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/es5-shim/2.2.0/es5-sham.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
</head>
<body>

View File

@ -16,7 +16,7 @@ File: [old_browsers.html](old_browsers.html) (click for a live demo)
<script src="//cdnjs.cloudflare.com/ajax/libs/es5-shim/2.2.0/es5-shim.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/es5-shim/2.2.0/es5-sham.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
</head>
<body>

View File

@ -2,7 +2,7 @@
<html>
<head>
<title>math.js | plot</title>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
<script src="https://cdn.plot.ly/plotly-1.35.2.min.js"></script>

View File

@ -11,7 +11,7 @@ File: [plot.html](plot.html) (click for a live demo)
<html>
<head>
<title>math.js | plot</title>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
<script src="https://cdn.plot.ly/plotly-1.35.2.min.js"></script>

View File

@ -3,7 +3,7 @@
<head>
<title>math.js | pretty printing with MathJax</title>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.3/MathJax.js?config=TeX-AMS-MML_HTMLorMML.js"></script>
<style>

View File

@ -12,7 +12,7 @@ File: [pretty_printing_with_mathjax.html](pretty_printing_with_mathjax.html) (cl
<head>
<title>math.js | pretty printing with MathJax</title>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.3/MathJax.js?config=TeX-AMS-MML_HTMLorMML.js"></script>
<style>

View File

@ -3,7 +3,7 @@
<head>
<title>math.js | printing HTML</title>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
<style>
body {

View File

@ -12,7 +12,7 @@ File: [printing_html.html](printing_html.html) (click for a live demo)
<head>
<title>math.js | printing HTML</title>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
<style>
body {

View File

@ -8,7 +8,7 @@
<script>
// load math.js using require.js
require(['https://unpkg.com/mathjs@5.10.0/dist/math.min.js'], function (math) {
require(['https://unpkg.com/mathjs@5.10.1/dist/math.min.js'], function (math) {
// evaluate some expression
const result = math.eval('1.2 * (2 + 4.5)')
document.write(result)

View File

@ -17,7 +17,7 @@ File: [requirejs_loading.html](requirejs_loading.html) (click for a live demo)
<script>
// load math.js using require.js
require(['https://unpkg.com/mathjs@5.10.0/dist/math.min.js'], function (math) {
require(['https://unpkg.com/mathjs@5.10.1/dist/math.min.js'], function (math) {
// evaluate some expression
const result = math.eval('1.2 * (2 + 4.5)')
document.write(result)

View File

@ -3,7 +3,7 @@
<head>
<title>math.js | rocket trajectory optimization</title>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script>
<style>

View File

@ -12,7 +12,7 @@ File: [rocket_trajectory_optimization.html](rocket_trajectory_optimization.html)
<head>
<title>math.js | rocket trajectory optimization</title>
<script src="https://unpkg.com/mathjs@5.10.0/dist/math.min.js"></script>
<script src="https://unpkg.com/mathjs@5.10.1/dist/math.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script>
<style>

View File

@ -91,7 +91,7 @@ File: [webworkers.html](webworkers.html) (click for a live demo)
File: [worker.js](worker.js) (click for a live demo)
```js
importScripts('https://unpkg.com/mathjs@5.10.0/dist/math.min.js')
importScripts('https://unpkg.com/mathjs@5.10.1/dist/math.min.js')
// create a parser
const parser = self.math.parser()

View File

@ -1,4 +1,4 @@
importScripts('https://unpkg.com/mathjs@5.10.0/dist/math.min.js')
importScripts('https://unpkg.com/mathjs@5.10.1/dist/math.min.js')
// create a parser
const parser = self.math.parser()

View File

@ -5,6 +5,13 @@ layout: default
<h1 id="history">History <a href="#history" title="Permalink">#</a></h1>
<h1 id="20190517-version-5101">2019-05-17, version 5.10.1 <a href="#20190517-version-5101" title="Permalink">#</a></h1>
- Fix <a href="https://github.com/josdejong/mathjs/issues/1512">#1512</a>: format using notation `engineering` can give wrong results
when the value has less significant digits than the number of digits in
the output.
<h1 id="20190508-version-5100">2019-05-08, version 5.10.0 <a href="#20190508-version-5100" title="Permalink">#</a></h1>
- Fix `lib/header.js` not having filled in date and version. Thanks <a href="https://github.com/kevjin">@kevjin</a>.

View File

@ -6,8 +6,8 @@
* It features real and complex numbers, units, matrices, a large set of
* mathematical functions, and a flexible expression parser.
*
* @version 5.10.0
* @date 2019-05-08
* @version 5.10.1
* @date 2019-05-17
*
* @license
* Copyright (C) 2013-2019 Jos de Jong <wjosdejong@gmail.com>
@ -1062,20 +1062,25 @@ exports.toEngineering = function (value, precision) {
if (exports.isNumber(precision)) {
// add zeroes to give correct sig figs
if (precision > c.length) c = c.concat(zeros(precision - c.length));
while (precision > c.length || e - newExp + 1 > c.length) {
c.push(0);
}
} else {
// concatenate coefficients with necessary zeros
var significandsDiff = e >= 0 ? e : Math.abs(newExp); // add zeros if necessary (for ex: 1e+8)
if (c.length - 1 < significandsDiff) c = c.concat(zeros(significandsDiff - (c.length - 1)));
while (c.length - 1 < significandsDiff) {
c.push(0);
}
} // find difference in exponents
var expDiff = Math.abs(e - newExp);
var decimalIdx = 1; // push decimal index over by expDiff times
while (--expDiff >= 0) {
while (expDiff > 0) {
decimalIdx++;
expDiff--;
} // if all coefficient values are zero after the decimal point and precision is unset, don't add a decimal value.
// otherwise concat with the rest of the coefficients
@ -34135,9 +34140,14 @@ exports.toEngineering = function (value, precision) {
var e = value.e;
var newExp = e % 3 === 0 ? e : e < 0 ? e - 3 - e % 3 : e - e % 3; // find difference in exponents, and calculate the value without exponent
var expDiff = Math.abs(e - newExp);
var valueWithoutExp = value.mul(Math.pow(10, expDiff - e));
return valueWithoutExp.toPrecision(precision).toString() + 'e' + (e >= 0 ? '+' : '') + newExp.toString();
var valueWithoutExp = value.mul(Math.pow(10, -newExp));
var valueStr = valueWithoutExp.toPrecision(precision);
if (valueStr.indexOf('e') !== -1) {
valueStr = valueWithoutExp.toString();
}
return valueStr + 'e' + (e >= 0 ? '+' : '') + newExp.toString();
};
/**
* Format a number in exponential notation. Like '1.23e+5', '2.3e+0', '3.500e-3'
@ -43740,7 +43750,7 @@ exports.math = true; // request access to the math namespace
/* 201 */
/***/ (function(module, exports) {
module.exports = '5.10.0'; // Note: This file is automatically generated when building math.js.
module.exports = '5.10.1'; // Note: This file is automatically generated when building math.js.
// Changes made in this file will be overwritten.
/***/ }),

10
js/lib/math.min.js vendored

File diff suppressed because one or more lines are too long

87
package-lock.json generated
View File

@ -91,23 +91,6 @@
"integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=",
"dev": true
},
"async": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz",
"integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==",
"dev": true,
"requires": {
"lodash": "^4.17.11"
},
"dependencies": {
"lodash": {
"version": "4.17.11",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==",
"dev": true
}
}
},
"atob": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
@ -308,9 +291,9 @@
"dev": true
},
"commander": {
"version": "2.17.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz",
"integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==",
"version": "2.20.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
"dev": true,
"optional": true
},
@ -320,9 +303,9 @@
"integrity": "sha512-6IArJLApNtdg1P1dFtn3dnyzoZBEF0MwMnrfF1exSBRpZYoy4yieMkpZhQDC0uwctw48vii0CFVyHfpgZ/DfGw=="
},
"component-emitter": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz",
"integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
"integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==",
"dev": true
},
"concat-map": {
@ -684,9 +667,9 @@
}
},
"fined": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/fined/-/fined-1.1.1.tgz",
"integrity": "sha512-jQp949ZmEbiYHk3gkbdtpJ0G1+kgtLQBNdP5edFP7Fh+WAYceLQz6yO1SBj72Xkg8GVyTB3bBzAYrHJVh5Xd5g==",
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/fined/-/fined-1.2.0.tgz",
"integrity": "sha512-ZYDqPLGxDkDhDZBjZBb+oD1+j0rA4E0pXY50eplAAOPg2N/gUBSSk5IM1/QhPfyVo19lJ+CvXpqfvk+b2p/8Ng==",
"dev": true,
"requires": {
"expand-tilde": "^2.0.2",
@ -759,9 +742,9 @@
"dev": true
},
"glob": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz",
"integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
"integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
@ -1076,12 +1059,12 @@
}
},
"handlebars": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.0.tgz",
"integrity": "sha512-l2jRuU1NAWK6AW5qqcTATWQJvNPEwkM7NEKSiv/gqOsoSQbVoWyqVEY5GS+XPQ88zLNmqASRpzfdm8d79hJS+w==",
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz",
"integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==",
"dev": true,
"requires": {
"async": "^2.5.0",
"neo-async": "^2.6.0",
"optimist": "^0.6.1",
"source-map": "^0.6.1",
"uglify-js": "^3.1.4"
@ -1146,9 +1129,9 @@
}
},
"homedir-polyfill": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz",
"integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=",
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz",
"integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==",
"dev": true,
"requires": {
"parse-passwd": "^1.0.0"
@ -1555,9 +1538,9 @@
}
},
"mathjs": {
"version": "5.10.0",
"resolved": "https://registry.npmjs.org/mathjs/-/mathjs-5.10.0.tgz",
"integrity": "sha512-AWvw1VRZv/37TlHGyAdUPc8U59jHE1cT4jfmM5D7Z18uUaGPqpG59Ia5VvQosxvO71KNBxXAImfxTwEt+6fA3A==",
"version": "5.10.1",
"resolved": "https://registry.npmjs.org/mathjs/-/mathjs-5.10.1.tgz",
"integrity": "sha512-OXj8e3NDNDGtEd8pWbZWLiifhVvxj1FRVxbs1iHq1mwU3yoCx+OfvDMNky0UyXJJYMI2OO6XrB41kBpoRcxMwQ==",
"requires": {
"complex.js": "2.0.11",
"decimal.js": "10.2.0",
@ -1683,6 +1666,12 @@
"integrity": "sha512-6+TDFewD4yxY14ptjKaS63GVdtKiES1pTPyxn9Jb0rBqPMZ7VcCiooEhPNsr+mqHtMGxa/5c/HhcC4uPEUw/nA==",
"dev": true
},
"neo-async": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz",
"integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==",
"dev": true
},
"object-assign": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz",
@ -1822,9 +1811,9 @@
}
},
"parse-node-version": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/parse-node-version/-/parse-node-version-1.0.0.tgz",
"integrity": "sha512-02GTVHD1u0nWc20n2G7WX/PgdhNFG04j5fi1OkaJzPWLTcf6vh6229Lta1wTmXG/7Dg42tCssgkccVt7qvd8Kg==",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/parse-node-version/-/parse-node-version-1.0.1.tgz",
"integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==",
"dev": true
},
"parse-passwd": {
@ -1983,9 +1972,9 @@
}
},
"resolve": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.9.0.tgz",
"integrity": "sha512-TZNye00tI67lwYvzxCxHGjwTNlUV70io54/Ed4j6PscB8xVfuBJpRenI/o6dVk0cY0PYTY27AgCoGGxRnYuItQ==",
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz",
"integrity": "sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
@ -2404,13 +2393,13 @@
"integrity": "sha512-TuQzwiT4DDg19beHam3E66oRXhyqlyfgjHB/5fcvsRXbfmWPJfto9B4a0TBdTrQAPGlGmXh/k7iUI+WsObgORA=="
},
"uglify-js": {
"version": "3.4.9",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz",
"integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==",
"version": "3.5.13",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.13.tgz",
"integrity": "sha512-Lho+IJlquX6sdJgyKSJx/M9y4XbDd3ekPjD8S6HYmT5yVSwDtlSuca2w5hV4g2dIsp0Y/4orbfWxKexodmFv7w==",
"dev": true,
"optional": true,
"requires": {
"commander": "~2.17.1",
"commander": "~2.20.0",
"source-map": "~0.6.1"
},
"dependencies": {

View File

@ -6,7 +6,7 @@
"url": "https://github.com/josdejong/mathjs.git"
},
"dependencies": {
"mathjs": "5.10.0"
"mathjs": "5.10.1"
},
"devDependencies": {
"glob": "^7.1.2",