Hexadecimal (also known as base-16 or simply hex) is a positional numeral system that represents numbers using a radix (base) of sixteen.
Software developers and system designers widely use hexadecimal numbers because they provide a convenient representation of binary-coded values.
There is some standardization of using spaces (rather than commas or another punctuation mark) to separate hex values in a long list.
[2] Hexadecimal representations are written there in a typewriter typeface: 5A3, C1F27ED In linear text systems, such as those used in most computer programming environments, a variety of methods have arisen: Sometimes the numbers are known to be Hex.
Since there were no traditional numerals to represent the quantities from ten to fifteen, alphabetic letters were re-employed as a substitute.
The following is a JavaScript implementation of the above algorithm for converting any number to a hexadecimal in String representation.
For example, to convert the number B3AD to decimal, one can split the hexadecimal number into its digits: B (1110), 3 (310), A (1010) and D (1310), and then get the final result by multiplying each decimal representation by 16p (p being the corresponding hex digit position, counting from right to left, beginning with 0).
Many computer systems provide a calculator utility capable of performing conversions between the various radices frequently including hexadecimal.
In Microsoft Windows, the Calculator, on its Programmer mode, allows conversions between hexadecimal and other common programming bases.
Because the radix 16 is a perfect square (42), fractions expressed in hexadecimal have an odd period much more often than decimal ones, and there are no cyclic numbers (other than trivial single digits).
Recurring digits are exhibited when the denominator in lowest terms has a prime factor not found in the radix; thus, when using hexadecimal notation, all fractions with denominators that are not a power of two result in an infinite string of recurring digits (such as thirds and fifths).
This makes hexadecimal (and binary) less convenient than decimal for representing rational numbers since a larger proportion lies outside its range of finite representation.
However, hexadecimal is more efficient than duodecimal and sexagesimal for representing fractions with powers of two in the denominator.
The table below gives the expansions of some common irrational numbers in decimal and hexadecimal.
The suanpan (Chinese abacus) can be used to perform hexadecimal calculations such as additions and subtractions.
The all-Latin alternative sexadecimal (compare the word sexagesimal for base 60) is older, and sees at least occasional use from the late 19th century.
[41] Many western languages since the 1960s have adopted terms equivalent in formation to hexadecimal (e.g. French hexadécimal, Italian esadecimale, Romanian hexazecimal, Serbian хексадецимални, etc.)
but others have introduced terms which substitute native words for "sixteen" (e.g. Greek δεκαεξαδικός, Icelandic sextándakerfi, Russian шестнадцатеричной etc.)
According to Knuth's argument, the correct terms for decimal and octal arithmetic would be denary and octonary, respectively.
[43][44] The now-current notation using the letters A to F establishes itself as the de facto standard beginning in 1966, in the wake of the publication of the Fortran IV manual for IBM System/360, which (unlike earlier variants of Fortran) recognizes a standard for entering hexadecimal constants.
This should have been done before poor choices gelled into a de facto standard!Martin's argument was that use of numerals 0 to 9 in nondecimal numbers "imply to us a base-ten place-value scheme": "Why not use entirely new symbols (and names) for the seven or fifteen nonzero digits needed in octal or hex.
Base16 (as a proper name without a space) can also refer to a binary to text encoding belonging to the same family as Base32, Base58, and Base64.
In this case, data is broken into 4-bit sequences, and each value (between 0 and 15 inclusively) is encoded using one of 16 symbols from the ASCII character set.
Most modern programming languages directly include support for formatting and parsing Base16-encoded numbers.