Code center > Darwinbots Program Source Code
Binary
Griz:
--- Quote ---A hex code is 4 bits (2^4 = 16, so each digit in Hex has 16 possible values). Thus each byte is represented by 2 hex codes.
You can convert numbers between hex, binary, and hexidecimal really easy, but I forget how at the moment. I always just use the calculator that comes with windows. In "scientific" mode it can operate as a converter between decimal, hex, and binary.
--- End quote ---
it's the same calculation regardless of base ...
using 4 digits for example:
--4--3--2--1
v4 v3 v2 v1
in decimal (base 10)
v(1-4) can be 0 to base-1 [or 0 - 9]
and the resulting value is an addition of:
v1 x base^0 = v1 x 10^0 = v1 x 1
v2 x base^1 = v2 x 10^1 = v2 x 10
v3 x base^2 = v3 x 10^2 = v3 x 100
v4 x base^1 = v4 x 10^3 = v4 x 1000
etc ... how ever many digits you want to go.
this is how we all learned to count.. or should have. ;)
in hexidecimal (base 16):
--4--3--2--1
v4 v3 v2 v1
where v(1-4) can be 0 to F [0 - 15]
the value is an addition of:
v1 x base^0 = v1 x 16^0 = v1 x 1
v2 x base^1 = v2 x 16^1 = v2 x 16
v3 x base^2 = v3 x 16^2 = v3 x 256
v4 x base^1 = v4 x 16^3 = v4 x 4096
in binary (base 2):
where 8 bits are used to make up a byte
v(1-8) can be 0 or 1
--8--7--6--5--4--3--2--1
v8 v7 v6 v5 v4 v3 v2 v1
the value is an addition of:
v1 x base^0 = v1 x 2^0 = v1 x 1
v2 x base^1 = v2 x 2^1 = v2 x 2
v3 x base^2 = v3 x 2^2 = v3 x 4
v4 x base^3 = v4 x 2^3 = v4 x 8
v5 x base^4 = v5 x 2^4 = v5 x 16
v6 x base^5 = v6 x 2^5 = v6 x 32
v7 x base^6 = v7 x 2^6 = v7 x 64
v8 x base^7 = v8 x 2^7 = v8 x 128
Note:
while in binary ...
it takes 8 digits to represent 0-255 (00000000 - 11111111)
in hex ...
it takes only 2 digits to represent 0-255 [00 to FF]
it's no mistake we use binary and hex in computers ...
as 2^8 = 16^2 = 256 and can be used to represent 0-255 ...
so we only need two placeholders instead of 8.
well ...
got carried away there ...
you guyz probable know all this and more.
I learned how to do all this by hand back when the
only calculator we had was a pencil and sliderule ...
and we geeks of those daze wore them slung from
our belts in leather holsters like a six-shooter ...
and the only computer ... one's own brain. ;)
and I just happen to love numbers ...
they make more sense then most people. :lol:
~griz~
Zelos:
I know how to change base, for crying out loud ive made a simple little program doing it. and im gonna show why 2^8 = 16^2 = 256
16=2^4
so 16^2=(2^4)^2=2^(2*4)=2^8
and voila its proven. But how can I be sure that (A^B )^C = A^(B*C)?
well, X^y=X times it self y times.
so let put numbers instant its easier:
(5^2)^3=5^2*5^2*5^2=5^(2+2+2)=5^(2*3)
but what about a^b*a^c=a^(b+c) then? lets take numers again its easier to see then:
5^2*5^3=(5*5)*(5*5*5)=5*5*5*5*5=5^5=5^(2+3)
and there we got it :D
now ur asking why did I do this? cause I wanted thats why
Griz:
--- Quote ---I know how to change base, for crying out loud ive made a simple little program doing it.
--- End quote ---
that's fine ...
but perhaps not every member here does ...
so maybe it's not all about you! ;)
I only offer this up for those who may not know ...
or may not have explored it in detail ...
to any who might be interested.
as with anything I post here or elsewhere ...
twywaltr
(take what you want and leave the rest) :P
~griz~
Zelos:
oh sorry, though you were thinking on my then. if you wanna tell the rest thats okey
Zelos:
nums, you said a while ago you had a formula that is easier for the computer to tell the square root, could you tell me that formula?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version