1
0
mirror of https://github.com/MikeMcl/decimal.js.git synced 2026-09-23 04:14:32 +00:00

#128 Accept + prefix

This commit is contained in:
Michael Mclaughlin
2019-05-08 17:05:12 +01:00
parent f468de8e79
commit 3f9eeb0897
3 changed files with 37 additions and 10 deletions

View File

@@ -3,7 +3,7 @@
/*
* decimal.js v10.1.1
* decimal.js v10.2.0
* An arbitrary-precision Decimal type for JavaScript.
* https://github.com/MikeMcl/decimal.js
* Copyright (c) 2019 Michael Mclaughlin <M8ch88l@gmail.com>
@@ -4341,10 +4341,12 @@
}
// Minus sign?
if (v.charCodeAt(0) === 45) {
if ((i = v.charCodeAt(0)) === 45) {
v = v.slice(1);
x.s = -1;
} else {
// Plus sign?
if (i === 43) v = v.slice(1);
x.s = 1;
}
@@ -4461,6 +4463,8 @@
*
* hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
*
* arguments {number|string|Decimal}
*
*/
function hypot() {
var i, n,
@@ -4735,6 +4739,8 @@
* -0 if x is -0,
* NaN otherwise
*
* x {number|string|Decimal}
*
*/
function sign(x) {
x = new this(x);