Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

big.js

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

big.js - npm Package Compare versions

Comparing version 6.0.2 to 6.0.3

73

big.js
/*
* big.js v6.0.1
* big.js v6.0.3
* A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.

@@ -356,3 +356,7 @@ * Copyright (c) 2020 Michael Mclaughlin

// Dividend is 0? Return +-0.
if (!a[0]) return new Big(k * 0);
if (!a[0]) {
y.s = k;
y.c = [y.e = 0];
return y;
}

@@ -508,5 +512,10 @@ var bl, bt, n, cmp, ri,

if (!xc[0] || !yc[0]) {
// y is non-zero? x is non-zero? Or both are zero.
return yc[0] ? (y.s = -b, y) : new Big(xc[0] ? x : 0);
if (yc[0]) {
y.s = -b;
} else if (xc[0]) {
y = new Big(x);
} else {
y.s = 1;
}
return y;
}

@@ -627,11 +636,11 @@

P.plus = P.add = function (y) {
var t,
var e, k, t,
x = this,
Big = x.constructor,
a = x.s,
b = (y = new Big(y)).s;
Big = x.constructor;
y = new Big(y);
// Signs differ?
if (a != b) {
y.s = -b;
if (x.s != y.s) {
y.s = -y.s;
return x.minus(y);

@@ -645,4 +654,13 @@ }

// Either zero? y is non-zero? x is non-zero? Or both are zero.
if (!xc[0] || !yc[0]) return yc[0] ? y : new Big(xc[0] ? x : a * 0);
// Either zero?
if (!xc[0] || !yc[0]) {
if (!yc[0]) {
if (xc[0]) {
y = new Big(x);
} else {
y.s = x.s;
}
}
return y;
}

@@ -653,8 +671,8 @@ xc = xc.slice();

// Note: reverse faster than unshifts.
if (a = xe - ye) {
if (a > 0) {
if (e = xe - ye) {
if (e > 0) {
ye = xe;
t = yc;
} else {
a = -a;
e = -e;
t = xc;

@@ -664,3 +682,3 @@ }

t.reverse();
for (; a--;) t.push(0);
for (; e--;) t.push(0);
t.reverse();

@@ -676,11 +694,11 @@ }

a = yc.length;
e = yc.length;
// Only start adding at yc.length - 1 as the further digits of xc can be left as they are.
for (b = 0; a; xc[a] %= 10) b = (xc[--a] = xc[a] + yc[a] + b) / 10 | 0;
for (k = 0; e; xc[e] %= 10) k = (xc[--e] = xc[e] + yc[e] + k) / 10 | 0;
// No need to check for zero, as +x + +y != 0 && -x + -y != 0
if (b) {
xc.unshift(b);
if (k) {
xc.unshift(k);
++ye;

@@ -690,3 +708,3 @@ }

// Remove trailing zeros.
for (a = xc.length; xc[--a] === 0;) xc.pop();
for (e = xc.length; xc[--e] === 0;) xc.pop();

@@ -709,3 +727,3 @@ y.c = xc;

var x = this,
one = new x.constructor(1),
one = new x.constructor('1'),
y = one,

@@ -774,3 +792,3 @@ isneg = n < 0;

e = x.e,
half = new Big(0.5);
half = new Big('0.5');

@@ -797,3 +815,3 @@ // Zero?

} else {
r = new Big(s);
r = new Big(s + '');
}

@@ -831,3 +849,6 @@

// Return signed 0 if either 0.
if (!xc[0] || !yc[0]) return new Big(y.s * 0);
if (!xc[0] || !yc[0]) {
y.c = [y.e = 0];
return y;
}

@@ -834,0 +855,0 @@ // Initialise exponent of result as x.e + y.e.

@@ -0,1 +1,6 @@

#### 6.0.3
* 02/12/20
* #148 Bugfix: primitive numbers passed to constructor internally in strict mode.
#### 6.0.2

@@ -22,3 +27,3 @@

* Remove `Big.version`.
* Rename *doc* folder to *docs* to use it as the Github publishing source.
* Rename *doc* folder to *docs* to use it as the GitHub publishing source.
* Add legacy API documentation to *docs*.

@@ -25,0 +30,0 @@ * Add *README* to *perf* directory.

{
"name": "big.js",
"description": "A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic",
"version": "6.0.2",
"version": "6.0.3",
"keywords": [

@@ -6,0 +6,0 @@ "arbitrary",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc