1
0
mirror of https://github.com/MikeMcl/decimal.js.git synced 2026-01-20 07:49:24 +00:00
This commit is contained in:
Hunter Wilhelm 2025-12-20 16:44:40 -07:00 committed by GitHub
commit 5d82744250
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 3 deletions

View File

@ -4861,7 +4861,8 @@
function sum() {
var i = 0,
args = arguments,
x = new this(args[i]);
firstArg = args[i],
x = new this(firstArg === undefined ? 0 : firstArg);
external = false;
for (; x.s && ++i < args.length;) x = x.plus(args[i]);

View File

@ -4856,7 +4856,8 @@ function sub(x, y) {
function sum() {
var i = 0,
args = arguments,
x = new this(args[i]);
firstArg = args[i],
x = new this(firstArg === undefined ? 0 : firstArg);
external = false;
for (; x.s && ++i < args.length;) x = x.plus(args[i]);

View File

@ -16,7 +16,8 @@ T('sum', function () {
t(11, -11);
t(1, '2', new Decimal(3), new Decimal('4'), -10);
t(new Decimal(-10), '9', new Decimal(0.01), 0.99);
t();
expected = new Decimal(10);
t('10');