Binary Decimal Hex Converter

Convert those base numbers

decimal, binary and hex 0 to 16 list

Decimal Binary Hexadecimal
0 00000000 0x0
1 00000001 0x1
2 00000010 0x2
3 00000011 0x3
4 00000100 0x4
5 00000101 0x5
6 00000110 0x6
7 00000111 0x7
8 00001000 0x8
9 00001001 0x9
10 00001010 0xa
11 00001011 0xb
12 00001100 0xc
13 00001101 0xd
14 00001110 0xe
15 00001111 0xf
16 00010000 0x10

Converting base numbers with JavaScript

This web page uses JavaScript for converting base numbers. JavaScript provides parseInt and toString methods for those purpose.

toString's first param is for converting decimal number to specific base number.

var i = 334;
console.log(i.toString(16)); // display 14e

parseInt's second param is for converting specific base number to decimal.

console.log(parseInt('101001110',2)); // display 334

But parseFloat doesnt provide param for converting base number. You have to write some script If you want to convert float from any base number.

I use those script that is in Stackoverflow.

function parseFloat(string, radix) {
  string = string.split(/\./);
  if (string[0] == '') {
    string[0] = "0";
  }
  if (string.length > 1 && string[1] != '') {
    var fractionLength = string[1].length;
    string[1] = parseInt(string[1], radix);
    string[1] *= Math.pow(radix, -fractionLength);
    return parseInt(string[0], radix) + string[1];
  }
  return parseInt(string[0], radix);
}

numbers - Converting hexadecimal to float in javascript - Stack Overflow

This function provide param for converting base number like parseInt.

console.log(parseFloat('21.666666666666', 16)); // display 33.4