Science Fair Project Encyclopedia
The word "hexadecimal" is strange in that hexa is derived from the Greek έξι (hexi) for "six" and decimal is derived from the Latin for "ten". An older term was the pure Latin "sexidecimal", but that was changed because some people thought it too risqué, and it also had an alternative meaning of "base 60". However, the word "sexagesimal" (base-60) retains the prefix.
Some hexadecimal numbers are indistinguishable from a decimal number (to both humans and computers). Therefore, some convention is usually used to flag them.
In typeset text, the indication is often a subscripted suffix such as 5A316, 5A3SIXTEEN, or 5A3HEX.
In computer programming languages (which are nearly always without such typographical distinctions as subscript and superscript) a wide variety of ways of marking hexadecimal numbers have appeared. Theese are also seen sometimes in documents especially ones that are plaintext and/or are related to a programming languate that uses them.
A list of the more common ones is given below:
- Ada and VHDL enclose hexadecimal numerals in based "numeric quotes", e.g. "16#5A3#". (Note: Ada accepts this notation for all bases from 2 through 16 and for both integer and real types.)
- C and languages with a similar syntax (such as C++, C# and Java) prefix hexadecimal numerals with "0x", e.g. "0x5A3". The leading "0" is used so that the parser can simply recognize a number, and the "x" stands for hexadecimal (c.f. O for Octal). The "x" in "0x" can be either in upper or lower case.
- In HTML, hexadecimal character references also use the x: ֣ should give the same as ֣ – with your browser ֣ and ֣ respectively (Hebrew accent munah).
- Some assemblers indicate hex by an appended "h" (if the numeral starts with a letter, then also with a preceding 0), e.g., "0A3Ch", "5A3h".
- Postscript indicates hex by a prefix "16#".
- Common Lisp use the prefixes "#x" and "#16r".
- Pascal, other assemblers (AT&T, Motorola), and some versions of BASIC use a prefixed "$", e.g. "$5A3".
- Some versions of BASIC, including Microsoft Visual Basic, prefix hexadecimal numerals with "&h", e.g. "&h5A3".
- Notations such as
X'5A3'are sometimes seen; PL/I uses such notation.
There is no single agreed-upon standard, so all the above conventions are in use, sometimes even in the same paper. However, as they are quite unambiguous, little difficulty arises from this.
The most commonly used (or encountered) notations are the ones with a prefix "0x" or a subscript-base 16, for hex numbers. For example, both 0x2BAD and 2BAD16 represent the decimal number 11181 (or 1118110).
A common use of hexadecimal numerals is found in HTML and CSS. They use hexadecimal notation (hex triplets) to specify colors on web pages; there is just the # symbol, not a separate symbol for "hexadecimal". Twenty-four-bit color is represented in the format #RRGGBB, where RR specifies the value of the Red component of the color, GG the Green component and BB the Blue component. For example, a shade of red that is 238,9,63 in decimal is coded as #EE093F. This syntax is borrowed from the X Window System.
The canonical written form of numeric IPv6 addresses represents each group of 16 bits as a separate hexadecimal number, to ease reading and transcription of the 128-bit addresses.
Because the radix 16 is a square (42), hexadecimal fractions have an odd period much more often than decimal ones. Recurring decimals occur when the denominator in lowest terms has a prime factor not found in the radix. In the case of hexadecimal numbers, all fractions with denominators that are not a power of two will result in a recurring decimal.
- numeral system for a list of other base systems.
- Nibble (1 hexadecimal digit can exactly represent 1 Nibble)
- Intuitor Hex Headquarters - A site dedicated to changing the traditional base 10 (decimal) standard to hexadecimal.
- - Simple Conversion Methods
- Hex/Decimal/Binary Convertor (integer only)
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details