Date: Sat, 27 Jan 2001 13:20:01 -0600 (CST) From: Mike Meyer <mwm@mired.org> To: "Mark B. Withers" <mwithers@one.net> Cc: questions@freebsd.org Subject: Re: hexidecimal literacy Message-ID: <14963.8033.752142.149320@guru.mired.org> In-Reply-To: <19700761@toto.iv>
next in thread | previous in thread | raw e-mail | index | archive | help
Mark B. Withers <mwithers@one.net> types: > Oh gosh! > > I thought I understood it before, but looking at it like this > simplifies it dramaticly!! Just remember that this applies to interesting bases like 0, 1, Pi and negative numbers :-). <mike > On Sat, Jan 27, 2001 at 03:31:17AM -0500, Donald J . Maddox wrote: > > Here's how it really works: > > > > Normally, we use base 10 numbers. What this means is that a number > > like "19,784" is interpreted as: > > > > 1 9 7 8 4 > > ^ ^ ^ ^ ^ > > | | | | |__ 4 x 10 ^ 0 + > > | | | |____ 8 x 10 ^ 1 + > > | | |______ 7 x 10 ^ 2 + > > | |________ 9 x 10 ^ 3 + > > |__________ 1 x 10 ^ 4 > > > > Hexadecimal numbers are exactly the same except that they use powers > > of 16 instead of 10. So, 0x19784 is interpreted as: > > > > 1 9 7 8 4 > > ^ ^ ^ ^ ^ > > | | | | |__ 4 x 16 ^ 0 + > > | | | |____ 8 x 16 ^ 1 + > > | | |______ 7 x 16 ^ 2 + > > | |________ 9 x 16 ^ 3 + > > |__________ 1 x 16 ^ 4 > > > > When using base 10 numbers, there are 10 symbols required, 0-9. When > > using hexadecimal numbers, there are 16 symbols required, 0-9 and a-f, > > where a-f would be 10,11,12,13,14,15 in decimals, so counting in hex > > goes like this: > > > > 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, 10, 11, 12, 13, 14, 15, > > 16, 17, 18, 19, 1a, 1b ... > > > > Note that 0x16 = 1 x 16 ^ 1 + 6 x 16 ^ 0, which would be 22 in decimal. > > > > Is any of this making sense? :) > > > > On Sat, Jan 27, 2001 at 02:47:23AM -0500, Mark B. Withers wrote: > > > Kewl! > > > > > > Thanks everyone for the help! I've studied it before but am quite > > > rusty. > > > > > > Mark > > > > > > On Sat, Jan 27, 2001 at 02:30:15AM -0500, Christopher Farley wrote: > > > > Mark B. Withers (mwithers@one.net) wrote: > > > > > > > > > I was wondering if someone could help me with understanding > > > > > hexidecimal numbers used in FreeBSD? > > > > > > > > This reminds me of the Onion story "Microsoft Patents 1s, 0s"... > > > > > > > > > I can relate mentally to the concept that the numeral system is based > > > > > on 16 instead of 10 like decimal numbers are. > > > > > > > > > > Is the prefix 0x always used? What does the 0x mean? > > > > > > > > The prefix 0x is always used to denote a hexidecimal number. The prefix > > > > 0 is used to denote an octal (base-8) number. > > > > > > > > Why ask why? > > > > > > > > > Would the hexidecimal number 0xf mean 16? > > > > > > > > Actually, it's 15. 0x10 would be 16. > > > > > > > > -- > > > > Christopher Farley > > > > www.northernbrewer.com > > > > > > > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > > > with "unsubscribe freebsd-questions" in the body of the message > > > > > > > > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > > with "unsubscribe freebsd-questions" in the body of the message > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > -- Mike Meyer <mwm@mired.org> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14963.8033.752142.149320>