From: tatewake@... (Terence Jordan)

Date: Tue, 9 Dec 1997 00:30:49 -0400

Date: Tue, 9 Dec 1997 00:30:49 -0400

>This is probably a basic question. So many people may know the answer. Yep, this is a cinch. >Is there a way in FB to convert Hex numbers into base-10 numbers, and >vice versa. Or is there a formula that I should be smart enough to >figure out on my own? Sure, hex is base 16, and base 10 is a normal number set. The easiest way to do this: myhex$=HEX$(base10num%) base10num%=VAL("&H"+myhex$) I've been using those two lines(well, at least pretty similar ones) since the Tandy CoCo days(or is that "daze"? :-) In C/Java, you represent Hexadecimal numbers like so: 0xFFFF and in basic: &HFFFF This would yield the number 65535... Off memory, you just separate the numbers: FF FF || || 255 255 * * 16^2 16^0 consider this: Dec(decimal/base 10) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Hex(hexidecimal/base 16) 0 1 2 3 4 5 6 7 8 9 A B C D E F It's actually pretty versatile, considering you can fit an 8 bit number into 2 characters. Can't beat that for compression... Then there's octal(base 8). Something i never really learned, same principle, though: 0 1 2 3 4 5 6 7 /\/\/\/\/\/\/\/\ 8 characters then repeat. Like hexidecimal. Too easy! And binary(base 2) 0 1 /\/\ two characters. boolean... Using hexadecimal in everyday life? I do...! Tim allen: "More power!" 1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536!! / __/ _____\-----====___/ / / / / / \ 2^8 = 65536.: 65536bytes/1024bytes(~1k) = 64k exactly! And it is my belief that all computers depend on those numbers directly! 128+512 = 640 32+64+128+256 = 480 the resolution of your screen! 1G ~ 1024M.: 1M ~ 1024k.: 1k ~ 1024bits Your hard drive? 32M = _2_ _16_bit Simms/Dimms? or _8_ _4_bit Simms/Dimms? Amount of Ram you have? Even in your modems; but that's a bit more complicated. All numbers used in the calculations above come from powers of 2. (Remember, 2^0 = 1; but where do we pull 0 from? It's not on our list of powers of 2. A loophole? My theory is that 1 is a bad number, and all numbers should be able to be subtracted by it to complete a range...) So I drifted a bit. Hope it helps... -- Terence Jordan (tatewake@...) Inspired Software. http://inspired.netstreet.net/ Macintosh, Dos, Windows, and BeOS software solutions. Phone: 407-728-7563 ............................................ . New: Renegade Space Ninja for Macintosh! . . Visit our page for more info. . ............................................