Number - Hexadecimal notation (0x)

> (Data|State) Management and Processing > (Data Type|Data Structure) > Number, Numeric, Quantity > Number - Hexadecimal notation (0x)

1 - About

Hexadecimal is a numeral system in base 16 (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F).

To see binary data in hexadecimal form, you use an hex editor.

Hexadecimal is more compact to write than binary. For example, the binary number 100110110100 is 9B4 in hexadecimal.

Advertising

3 - Representation in Text

Hexadecimal numbers in text are specified with a prefix

Language Prefix Note
C / Java 0x 0x1 0x01, 0x001, and 0x0001 are all the same
Pascal $
HTML #

4 - Conversion

4.1 - Calculator

Windows calculator, in Programmer mode, to see and convert:

Advertising

4.2 - Javascript

Decimal to Binary to Hexadecimal

function numberRepresentation(decimal, binary, hexadecimal) {
  this.decimal = decimal;
  this.binary = binary;
  this.hexadecimal = hexadecimal;
}
numbers =[]
for (var i=0;i<=16;i++) {
   numbers.push(
       new numberRepresentation(
           i,
           i.toString(2),
           i.toString(16).toUpperCase()
       )
   );
}
console.table(numbers);

data/type/number/hex/hex.txt · Last modified: 2019/07/08 13:25 by gerardnico