Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Hexadecimal
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Binary conversion=== [[File:Hewlett-Packard Model HP-16C Programmable RPN Calculator, HP's First and Only Calculator esp. for Programmers, built 1982-1989 (edited to rectangular, V2).jpg|thumb|The programmable [[Reverse Polish notation|RPN]]-calculator [[HP-16C|HP-16C Computer Scientist]] from 1982 was designed for programmers. One of its key features was the conversion between different numeral systems (note hex number in display).]] Most computers manipulate binary data, but it is difficult for humans to work with a large number of digits for even a relatively small binary number. Although most humans are familiar with the base 10 system, it is much easier to map binary to hexadecimal than to decimal because each hexadecimal digit maps to a whole number of bits (4<sub>10</sub>). This example converts 1111<sub>2</sub> to base ten. Since each [[Positional notation|position]] in a binary numeral can contain either a 1 or a 0, its value may be easily determined by its position from the right: * 0001<sub>2</sub> = 1<sub>10</sub> * 0010<sub>2</sub> = 2<sub>10</sub> * 0100<sub>2</sub> = 4<sub>10</sub> * 1000<sub>2</sub> = 8<sub>10</sub> Therefore: {| |- | 1111<sub>2</sub>|| = 8<sub>10</sub> + 4<sub>10</sub> + 2<sub>10</sub> + 1<sub>10</sub> |- | || = 15<sub>10</sub> |} With little practice, mapping 1111<sub>2</sub> to F<sub>16</sub> in one step becomes easy (see table in [[#Written representation|written representation]]). The advantage of using hexadecimal rather than decimal increases rapidly with the size of the number. When the number becomes large, conversion to decimal is very tedious. However, when mapping to hexadecimal, it is trivial to regard the binary string as 4-digit groups and map each to a single hexadecimal digit.<ref name=Mano-Ciletti/> This example shows the conversion of a binary number to decimal, mapping each digit to the decimal value, and adding the results. {| | (1001011100)<sub>2</sub>|| = 512<sub>10</sub> + 64<sub>10</sub> + 16<sub>10</sub> + 8<sub>10</sub> + 4<sub>10</sub> |- | || = 604<sub>10</sub> |} Compare this to the conversion to hexadecimal, where each group of four digits can be considered independently and converted directly: {| |- | (1001011100)<sub>2</sub>|| = ||0010<sub> </sub>||0101<sub> </sub>||1100<sub>2</sub> |- | || = || align="center" |2|| align="center" |5||align="center" |C<sub>16</sub> |- | || = || colspan="5" |25C<sub>16</sub> |} The conversion from hexadecimal to binary is equally direct.<ref name=Mano-Ciletti>{{cite book|title=Digital Design β With an Introduction to the Verilog HDL|edition=Fifth|last1=Mano|first1=M. Morris|last2=Ciletti|first2=Michael D.|publisher=[[Pearson Education]]|date=2013|pages=6, 8β10|isbn=978-0-13-277420-8}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)