Arbitrary precision decimal
npm install --save hex2dec
var converter = require('hex2dec');
var dec = converter.hexToDec('0xFA'); // 250
var hex = converter.decToHex('250'); // '0xfa'
var hexString = converter.decToHex('250', { prefix: false }); // 'fa'
(250).toString(16) === 'fa'
and 250 === 0xFA
both work just fine, and will provide enough precision for most uses. For large (>64-bit) numbers, however, precision is lost. This utility provides a higher-precision alternative.
This code may be used under the Apache 2 license.