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

@phensley/decimal

Package Overview
Dependencies
Maintainers
1
Versions
198
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@phensley/decimal - npm Package Compare versions

Comparing version 0.6.10 to 0.6.11

46

lib/decimal.js

@@ -8,2 +8,3 @@ "use strict";

var types_1 = require("./types");
var floor = Math.floor;
var GROUP_NOOP = function () {

@@ -355,3 +356,3 @@ // nothing

var r = new Decimal(this);
r._setScale(scale, roundingMode);
r._setScale(floor(scale), roundingMode);
return r;

@@ -373,3 +374,3 @@ };

var w = new Decimal(this);
w.exp += n;
w.exp += floor(n);
return w;

@@ -382,3 +383,3 @@ };

var w = new Decimal(this);
w._shiftleft(shift);
w._shiftleft(floor(shift));
return w;

@@ -393,3 +394,3 @@ };

var w = new Decimal(this);
w._shiftright(shift, mode);
w._shiftright(floor(shift), mode);
return w;

@@ -473,12 +474,15 @@ };

}
// Push trailing zeros for a positive exponent
// Push trailing zeros for a positive exponent, only if the number
// is non-zero
var zeros = exp;
while (zeros > 0) {
formatter.add(digits[0]);
emitted++;
int--;
if (int > 0) {
groupFunc();
if (this.sign !== 0) {
while (zeros > 0) {
formatter.add(digits[0]);
emitted++;
int--;
if (int > 0) {
groupFunc();
}
zeros--;
}
zeros--;
}

@@ -514,8 +518,10 @@ // Scan coefficient from least- to most-significant digit.

// If exponent still negative, emit leading decimal zeros
while (exp < 0) {
formatter.add(digits[0]);
// When we've reached exponent of 0, push the decimal point
exp++;
if (exp === 0) {
formatter.add(decimal);
if (this.sign !== 0) {
while (exp < 0) {
formatter.add(digits[0]);
// When we've reached exponent of 0, push the decimal point
exp++;
if (exp === 0) {
formatter.add(decimal);
}
}

@@ -909,6 +915,6 @@ }

var TWO = new Decimal('2');
// https://oeis.org/A000796/constant
// 105 digits of pi - https://oeis.org/A000796/constant
var PI = new Decimal('3.141592653589793238462643383279502884197169399375105' +
'82097494459230781640628620899862803482534211706798214');
// https://oeis.org/A001113/constant
// 105 digits of e - https://oeis.org/A001113/constant
var E = new Decimal('2.718281828459045235360287471352662497757247093699959' +

@@ -915,0 +921,0 @@ '57496696762772407663035354759457138217852516642742746');

{
"name": "@phensley/decimal",
"version": "0.6.10",
"version": "0.6.11",
"description": "Arbitrary precision decimal math",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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