Skip site navigation (1)Skip section navigation (2)
From:      "Mark B. Withers" <mwithers@one.net>
To:        "Donald J . Maddox" <dmaddox@sc.rr.com>
Cc:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: hexidecimal literacy
Message-ID:  <20010127124814.B287@arrakis.desert-power.org>
In-Reply-To: <20010127033105.A13484@cae88-102-101.sc.rr.com>; from dmaddox@sc.rr.com on Sat, Jan 27, 2001 at 03:31:17AM -0500
References:  <20010127022257.A32133@arrakis.desert-power.org> <20010127012952.B31323@northernbrewer.com> <20010127024918.C32133@arrakis.desert-power.org> <20010127033105.A13484@cae88-102-101.sc.rr.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Oh gosh!

I thought I understood it before, but looking at it like this
simplifies it dramaticly!!

Thanks again!

Mark

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010127124814.B287>