@yaffle/bigdecimal
Advanced tools
Comparing version 1.0.16 to 1.0.17
@@ -370,2 +370,3 @@ /*jslint bigint: true, vars: true, indent: 2*/ | ||
} | ||
if (BASE !== 2) { | ||
const differenceOfLogarithms = Number(sum(diff(a.exponent, b.exponent), (digits(a.significand) - digits(b.significand)))); | ||
@@ -375,2 +376,13 @@ if (differenceOfLogarithms !== 0) { | ||
} | ||
} else { | ||
const x = a.exponent >= b.exponent ? a.significand : a.significand >> BigInt(diff(b.exponent, a.exponent)); | ||
const y = b.exponent >= a.exponent ? b.significand : b.significand >> BigInt(diff(a.exponent, b.exponent)); | ||
if (x < y) { | ||
return -1; | ||
} | ||
if (y < x) { | ||
return +1; | ||
} | ||
//return x < y ? -1 : (x > y ? +1 : 0); | ||
} | ||
const x = a.exponent <= b.exponent ? a.significand : bigIntScale(a.significand, diff(a.exponent, b.exponent)); | ||
@@ -377,0 +389,0 @@ const y = b.exponent <= a.exponent ? b.significand : bigIntScale(b.significand, diff(b.exponent, a.exponent)); |
{ | ||
"name": "@yaffle/bigdecimal", | ||
"version": "1.0.16", | ||
"version": "1.0.17", | ||
"description": "Arbitrary precision decimal arithmetic library. Polyfill for decimal proposal. Implemented on the top of BigInt.", | ||
@@ -5,0 +5,0 @@ "main": "BigDecimal.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43454
877