node-nums
v0.0.2
Published
Change a number from one base to another, get decimal or binary representations of a number
Downloads
2
Readme
node-nums
npm install node-nums
var nums = require('node-nums');
Change base of number:
var tenInBaseThree = nums.changeBase(10, 3);
//Returns string '101'
Get binary representation of a number:
var binaryReprOfTen = nums.getBinary(10);
//Returns binary string '0101'
Get decimal representation of number in non-decimal base:
//The inital base is given as a second parameter
var tenInBaseThree = nums.changeBase(10, 3),
backToDec = nums.getDecimal(tenInBaseThree);
//Returns a number in base ten