Author Topic: Binary  (Read 7842 times)

Offline Zelos

  • Bot Overlord
  • ****
  • Posts: 707
    • View Profile
Binary
« on: October 15, 2005, 11:18:21 AM »
nums, you talk about in enzymes about using hexa for enzyme codes. the question is how big is one of those in bits? is it 4 bits? and is "1" 0001 in bits? and "2" 0010? and "F" 1111?
and is there a way to know what bit pattern a you represent?
« Last Edit: October 15, 2005, 11:25:58 AM by Zelos »
When I have the eclipse cannon under my control there is nothing that can stop me from ruling the world. And I wont stop there. I will never stop conquering worlds through the universe. All the worlds in the universe will belong to me. All the species in on them will be my slaves. THE ENIRE UNIVERSE WILL BELONG TO ME AND EVERYTHING IN IT :evil: AND THERE IS NOTHING ANYONE OF you CAN DO TO STOP ME. HAHAHAHAHAHAHAHA

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Binary
« Reply #1 on: October 15, 2005, 12:21:58 PM »
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.

Offline Zelos

  • Bot Overlord
  • ****
  • Posts: 707
    • View Profile
Binary
« Reply #2 on: October 15, 2005, 12:40:13 PM »
Nice, but what about letters? doesnt each letter represent a byte? so how do I convert a binary code/ hexa code into a letter as we know them?
« Last Edit: October 15, 2005, 12:45:32 PM by Zelos »
When I have the eclipse cannon under my control there is nothing that can stop me from ruling the world. And I wont stop there. I will never stop conquering worlds through the universe. All the worlds in the universe will belong to me. All the species in on them will be my slaves. THE ENIRE UNIVERSE WILL BELONG TO ME AND EVERYTHING IN IT :evil: AND THERE IS NOTHING ANYONE OF you CAN DO TO STOP ME. HAHAHAHAHAHAHAHA

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Binary
« Reply #3 on: October 15, 2005, 12:43:19 PM »
In hex:

A = 10 in decimal
B = 11 "
C = 12
D = 13
E = 14
F = 15
10 = 16

Offline Zelos

  • Bot Overlord
  • ****
  • Posts: 707
    • View Profile
Binary
« Reply #4 on: October 15, 2005, 12:47:17 PM »
I know that, I got hexa on my calculator and my first program.
in the vb code of db how were you acctualy planning doing this kind of stuff? I mean making a code of letters/hexa into stuff the program can read?
When I have the eclipse cannon under my control there is nothing that can stop me from ruling the world. And I wont stop there. I will never stop conquering worlds through the universe. All the worlds in the universe will belong to me. All the species in on them will be my slaves. THE ENIRE UNIVERSE WILL BELONG TO ME AND EVERYTHING IN IT :evil: AND THERE IS NOTHING ANYONE OF you CAN DO TO STOP ME. HAHAHAHAHAHAHAHA

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Binary
« Reply #5 on: October 15, 2005, 12:57:36 PM »
I would create an array of booleans to represent bits.  I've already done that for the new bit operators in the DNA for 2.4

Offline Zelos

  • Bot Overlord
  • ****
  • Posts: 707
    • View Profile
Binary
« Reply #6 on: October 15, 2005, 01:14:53 PM »
hmmm, so true = 1 and false = 0?
interesting, but what about mixing them?
When I have the eclipse cannon under my control there is nothing that can stop me from ruling the world. And I wont stop there. I will never stop conquering worlds through the universe. All the worlds in the universe will belong to me. All the species in on them will be my slaves. THE ENIRE UNIVERSE WILL BELONG TO ME AND EVERYTHING IN IT :evil: AND THERE IS NOTHING ANYONE OF you CAN DO TO STOP ME. HAHAHAHAHAHAHAHA

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Binary
« Reply #7 on: October 15, 2005, 01:15:54 PM »
How do you mean mixing?

Like reconstructing a decimal value based on the bits?  Or...

Offline Zelos

  • Bot Overlord
  • ****
  • Posts: 707
    • View Profile
Binary
« Reply #8 on: October 15, 2005, 01:29:26 PM »
didnt you say that if we have a binary code like 1010 the program will mix it around so it becomes something like 0110 and then it begins readiing?
When I have the eclipse cannon under my control there is nothing that can stop me from ruling the world. And I wont stop there. I will never stop conquering worlds through the universe. All the worlds in the universe will belong to me. All the species in on them will be my slaves. THE ENIRE UNIVERSE WILL BELONG TO ME AND EVERYTHING IN IT :evil: AND THERE IS NOTHING ANYONE OF you CAN DO TO STOP ME. HAHAHAHAHAHAHAHA

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Binary
« Reply #9 on: October 15, 2005, 02:32:37 PM »
Oh, yeah.  That's easy, you just XOR swap bits if you want to rearrange, or compliment the bit if you want to change it, etc.

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Binary
« Reply #10 on: October 15, 2005, 02:48:35 PM »
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.
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~
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Zelos

  • Bot Overlord
  • ****
  • Posts: 707
    • View Profile
Binary
« Reply #11 on: October 15, 2005, 02:50:38 PM »
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
« Last Edit: October 15, 2005, 02:58:33 PM by Zelos »
When I have the eclipse cannon under my control there is nothing that can stop me from ruling the world. And I wont stop there. I will never stop conquering worlds through the universe. All the worlds in the universe will belong to me. All the species in on them will be my slaves. THE ENIRE UNIVERSE WILL BELONG TO ME AND EVERYTHING IN IT :evil: AND THERE IS NOTHING ANYONE OF you CAN DO TO STOP ME. HAHAHAHAHAHAHAHA

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Binary
« Reply #12 on: October 15, 2005, 02:58:55 PM »
Quote
I know how to change base, for crying out loud ive made a simple little program doing it.
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~
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Zelos

  • Bot Overlord
  • ****
  • Posts: 707
    • View Profile
Binary
« Reply #13 on: October 15, 2005, 03:09:11 PM »
oh sorry, though you were thinking on my then. if you wanna tell the rest thats okey
When I have the eclipse cannon under my control there is nothing that can stop me from ruling the world. And I wont stop there. I will never stop conquering worlds through the universe. All the worlds in the universe will belong to me. All the species in on them will be my slaves. THE ENIRE UNIVERSE WILL BELONG TO ME AND EVERYTHING IN IT :evil: AND THERE IS NOTHING ANYONE OF you CAN DO TO STOP ME. HAHAHAHAHAHAHAHA

Offline Zelos

  • Bot Overlord
  • ****
  • Posts: 707
    • View Profile
Binary
« Reply #14 on: October 15, 2005, 03:25:47 PM »
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?
When I have the eclipse cannon under my control there is nothing that can stop me from ruling the world. And I wont stop there. I will never stop conquering worlds through the universe. All the worlds in the universe will belong to me. All the species in on them will be my slaves. THE ENIRE UNIVERSE WILL BELONG TO ME AND EVERYTHING IN IT :evil: AND THERE IS NOTHING ANYONE OF you CAN DO TO STOP ME. HAHAHAHAHAHAHAHA