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

num

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

num - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

test/cmp.js

17

num.js

@@ -178,6 +178,17 @@ var int = require('int');

Num.cmp = function(a, b) {
a = ensure_num(a);
b = ensure_num(b);
return a.sub(b).toNumber();
// make copies cause we modify precision
var a = Num(a);
var b = Num(b);
if (a._int._s != b._int._s) {
return a._int._s ? -1 : 1;
}
// normalize the two numbers
var precision = Math.max(a._precision, b._precision);
a.set_precision(precision);
b.set_precision(precision);
return a._int.cmp(b._int);
};

@@ -184,0 +195,0 @@

@@ -5,3 +5,3 @@ {

"description": "arbitrary precision integer and decimal library in pure javascript",
"version": "0.0.1",
"version": "0.0.2",
"repository": {

@@ -11,5 +11,11 @@ "type": "git",

},
"keywords": [
"decimal",
"num",
"arithmatic",
"precision"
],
"main": "num.js",
"dependencies": {
"int": "0.0.3"
"int": "0.1.0"
},

@@ -22,3 +28,6 @@ "devDependencies": {

"node": "*"
},
"scripts": {
"test": "mocha"
}
}

2

README.md

@@ -7,3 +7,3 @@ [![Build Status](https://secure.travis-ci.org/shtylman/node-num.png)](http://travis-ci.org/shtylman/node-num)

Looking for just integers? Check out **int** at shtylman/node-int
Looking for just integers? Check out [int](https://github.com/shtylman/node-int)

@@ -10,0 +10,0 @@ ## quick and dirty ##

@@ -38,1 +38,7 @@

test('build#precision', function() {
assert.equal(num(15, 1), '1.5');
assert.equal(num(1234567890, 5), '12345.67890');
assert.equal(num(-122, 4), '-0.0122');
});
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