• Welcome to League Of Reason Forums! Please read the rules before posting.
    If you are willing and able please consider making a donation to help with site overheads.
    Donations can be made via here

binary

blinddesign

New Member
arg-fallbackName="blinddesign"/>
anyone with any knowledge of binary:
-how do i write large numbers or, more specifically, how do i figure out quickly in my head how to write large numbers?

-how do i write stuff after the decimal (or binary?) point? if the digits multiply in value by two leftwards, does it halve towards the right after the point?

also, anyone with any other questions are welcome to ask (you can ask me for the very basics).
 
arg-fallbackName="Netheralian"/>
Hmm - i had something written, but i realised i probably wasn't going to tell you anything you don't already know about log base 2 (and being able to do it in Excel with a bin2dec function). I don't know if there is any quick way of doing it in your head unless you know your log base 2 tables...

As for the second question, I was mucking about with it a litte as I don't recall doing this since Highschool.

I tried to see if I could write 9.9 in binary. What i ended up with was
1001.1(1100 recurring). Where obviously anything to the right of the decimalpoint is the same as in decimal but instead of 10^-x its 2^-x. So it would be:
2^3+2^0+2^-1+ Sum (2^n+2^(n-1)) where n = -2,-6,-10, 14 -> inf.
Appologies if the notation is confusing - I also can't remember how to write this anymore...

You just have to remember decimal, binary, hex etc works in exactly the same way (and is written the same way), its just the base thats different. I.e. 10^x or 2^x or 16^x etc. So anything you would write in Decimal you write it the same way in binary. Its just a little maths to convert them.

Am now hoping you don't want more of a response from me as I am about to go out...
 
arg-fallbackName="Spase"/>
Well..

I'm not an expert (at all?) but I can point in the direction of information. There are a number of systems for representing numbers in binary and some of them are really pretty clever.

Two's complement, a nifty way of representing positive and negative numbers so that addition and subtraction work the same way on positive and negative numbers. This is useful because taking time to examine a number's sign wastes cycles:

http://en.wikipedia.org/wiki/Two%27s_complement


More complicated; the representation of floating point numbers. This whole page is about floats but the part I linked it specific to their binary representation:

http://en.wikipedia.org/wiki/Floating_point#Internal_representation

I don't really know this stuff in any depth. My dad teaches it.. so I hear about it when I ask him how his classes are going.. And it's cool stuff so I pay some attention.. though without any testing on it I never was motivated enough to really be solid on it or I'd try to give a real explanation. My programming is all in languages people have actually heard of.. rather than various assembly codes (what he does).

[edit]:

Having re-read your question I think I may have misunderstood your question. If you mean how do you do a straight conversion of decimal numbers to binary rather than how do computers represent them Netheralian does as good a job answering the question and I could do. I can ask though and if there's a clear/precise system I'll post it when I get the chance.
 
arg-fallbackName="Spase"/>
Ooo,

Algorithmic way of assigning any arbitrarily large number a binary representation.

You divide the number by two and every time you divide you put the remainder in the next available place.

For example, the number 6 in binary is 110. To get this you divide 6 by two. remainder is 0. 0 goes in the 'ones' place. Next you divide 3 (the result of 6/2) by 2. You get remainder 1. You put the 1 left end giving us 10 so far. Next you take the result which is 1 and find 2 goes into it 0 times with remainder 1. you put this last one on your number and get 110.

Let me know if this wasn't clear. It's a very simple process and easy to explain with a piece of paper but I'm not sure my writing is doing it justice.
 
arg-fallbackName="Aught3"/>
^hmm interesting let me try it with 11
11 odd so 1
1/2 10 is 5, odd so 1
1/2 4 is 2, even so 0
Is that it 11 = 011 in binary?
It didn't work :( What did I do wrong?
 
arg-fallbackName="blinddesign"/>
Spase said:
Ooo,

Algorithmic way of assigning any arbitrarily large number a binary representation.

You divide the number by two and every time you divide you put the remainder in the next available place.

For example, the number 6 in binary is 110. To get this you divide 6 by two. remainder is 0. 0 goes in the 'ones' place. Next you divide 3 (the result of 6/2) by 2. You get remainder 1. You put the 1 left end giving us 10 so far. Next you take the result which is 1 and find 2 goes into it 0 times with remainder 1. you put this last one on your number and get 110.

Let me know if this wasn't clear. It's a very simple process and easy to explain with a piece of paper but I'm not sure my writing is doing it justice.

that's what i meant, thanks. an easy and quick conversion method. now, i have another thing i need clearing up, it's hard to put this question into words but here it goes:

(with spaces in the numbers for clarity)
<n>=base number
after the decimal point, how do i write numbers... aww shizzle, this is hard to explain. ok, as i am writing numbers after the point like-

<10> 0. 3
<2> 0. 11

-how would i carry on without confusion? like-

<10> 0. 3 2 5 4
<2> 0. 11 10 101 100

which could be-

<10> 0.940

ok, i think i have realised my problem. should it be?-

<10> 0.3254
<2> 0.110010110110 (that took work)


sorry if i have been rambling a bit in this post but i was kind of working out as i went along.
 
arg-fallbackName="blinddesign"/>
Aught3 said:
^hmm interesting let me try it with 11
11 odd so 1
1/2 10 is 5, odd so 1
1/2 4 is 2, even so 0
Is that it 11 = 011 in binary?
It didn't work :( What did I do wrong?


funnily enough, i did this method with a large number in my previous post and only got one digit wrong (human error) but i tried this and i got the same answer as thine... intruiging.
 
arg-fallbackName="Spase"/>
Okay. Now.. I tried... and same issue.

I'll post as soon as I figure out what's happening. I might not have the process quite right. it was explained to me fast and I tried it on two numbers before posting to be sure I wasn't confused (worked for 6 and 15).

doing 4 seems to have the same problem. In fact it's the same kind of problem. 4 should be 100 but this method is giving me 00. There seems to have to be some rule concerning carrying the 1 if the last digit you get is a 0.

should count like this
0 =0
1 =1
10 =2
11 =3
100 =4
101 =5
110 =6
111 =7

from this I guess 5 would have the same problem and it does. It's a clear pattern... oh wait. if 2 goes into something evenly it's like 10 going into something evenly. Yah. You carry and put a "10" on front instead of a "0" which would make no sense.
 
arg-fallbackName="Aught3"/>
Oh I got it.
1/2 of 2 is 1 odd so 1

that makes the final answer 1011
Yay!
 
arg-fallbackName="Ozymandyus"/>
11/2 = 5 remainder (1) 2 remainder (1) 1 remainder (0) 0 remainder (1)
1011

oh you already got it.. nm

Edit: Thought I would add that you can use this method to convert to any other base by the way, like base 5 (quinary).

50/5 = 10 remainder (0) 2 remainder (0) 0 remainder (2)
so 200 = 50 in quinary

Good times.
 
arg-fallbackName="Master_Ghost_Knight"/>
Introduction to base number notation:
For a given string of chars written in base 10
Ex. 1234
It is identical to
31484878.gif

This is each of the digit a known value is associate and it is multiplied by a power of the respective base it is written in while the power depends on the position that digit is.

For a generic base b, the number "¦j"¦klo,pq"¦r"¦ is the same as:
36585642.gif

For a generic notation
81620053.gif

Whit b, n,m, j,k,l,o,p,q,r,"¦ positive integer, j,k,l,o,p,q,r,"¦<b and b>=2

Why are j,k,l,o,p,q,r,"¦<b?
Take a generic construction for b>=2
29731850.gif

That when added
15606248.gif

The following occurs
43762127.gif

37585047.gif

35783462.gif

And because we can always do this, we use this as a rule to simplify the notation

Why b>=2?
B is a positive integer and j,k,l,o,p,q,r,"¦<b and are also positive integer (including 0)
If we take for instance b<2, the only solutions are 1 and 0 for b positive integer, sense j,k,l,o,p,q,r,"¦<b if b=0 there is no positive integer j for which j<b (there b cannot be 0). If b=1 then the only solution for j,k,l,o,p,q,r,"¦<b is "0" for which
53750383.gif

And we don't have a working system to represent any number different from 0.

The most significant digit (higher power) is written to the left and less significant digits are written rightwards towards smaller order of magnitude.
The unit digit is also known as digit 0
Negative orders of magnitude are represented after a coma.
Zeros at the left of the comma can optionally not be written if there isn't any other number different from 0 leftwards, Zeros at the right of the comma can optionally not be written if there isn't any other number different from 0 rightwards.

Generally to identify the base the number is written in we write the number between parentheses and adding the index b.
98655170.gif


=====================================================================

Examples of bases:
Base 16:
One of the very common none base 10 base system in the hexadecimal (b=16)
For which j,k,l,o,p,q,r,"¦<b has the following solutions:
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Now we come to a problem when we have to use for instance j>9 because or standard numerals have only 10 different characters to represent and clustering it would raise ambiguity to what exact number would that represent, to raise that ambiguity, alphabetical characters are "borrowed" to represent bigger values (A,B,C,D,E,F).
0=0; 1=1; 2=2; 3=3; 4=4; 5=5; 6=6; 7=7; 8=8; 9=9; A=10; B=11; C=12; D=13; E=14; F=15

Base 2:
This is the simplest bases and perhaps the most useful bases we have today. Due to properties of semi-conductor technology that historically only allowed to make a correspondence to 2 different stable states. Although electronic machines where mainly build to manage simple states without a concept of number, the association whit a base 2 mathematical system allowed the construction of calculating machines and latter on computers.

=======================================================================

Base conversion:
From other bases to base 10:
This is a very simple operation.
All you have to do is to get the correspondent value of the digit, multiply it by the base powered to the position, keep doing this for all the digits, then sum them all together.
Because as we already seen the base b representation is identical to:
81620053.gif

All you have to do is to perform the operations as if it was in base 10

Example Conversion from base 2 to base 10
94664909.gif

86180491.gif


From base 10 to other bases:
The conversion from base 10 to other bases is in a way the reverse operation of the conversion from that same base to 10. But we do not know how to perform operations in other bases to well, and the real content seams a little bit confusing to tell which is which.
So instead we use a different algorithm.
Sense we already seen that the numbers written in base b are identical to:
81620053.gif

And by a quick analysis the fractional part (negative power) of the number can only be formed if the number itself is fractional (i.e. fractional in one base is fractional in all bases, integer in one base is integer in all bases). So we start processing the number by splitting its fractional part from the integer part and then processing both parts separately and in the end add them back together.
Processing the integer part:
To convert is to a base b we start by whole dividing the number by b, and has we do that, notice that we can do an whole division to every digit except for the unit digit (because as we have seen it is smaller than b), so the remainder of the first whole division by b is the unit digit.
66896931.gif

Now notice that the part that was successfully divided loses 1 power and as we whole devide it again by b the next digit is now the remainder. And we keep do this "whole division and take remainder" process until we are only left whit a zero.

Processing the fractional part:
To convert it to base b you simply multiply by b, notice that the number gains 1 power and now the first fractional digit is now a whole and can be read without the base b associated to it.
19176504.gif

To continue all you have to do is to take the fractional part of this new number and multiply it again by b and as we do this the next fractional digit is now whole and can be read without the b associated with it. You keep doing this until there is only zero left or if it enters a loop (and in that case it is a recurring number).
Finally add the converted whole part and the converted fractional part together.


Next lecture is on quick methods convertions between some special bases. binary operations, bolean logic and introduction to digital systems. (perhaps we can get to the part of building a microprocessor)
 
arg-fallbackName="Master_Ghost_Knight"/>
Quick conversion between binary and other bases powers of 2.
As we compare other bases powers of 2 that can also be written in the following form:
74709338.gif

That formulates numbers that are equivalent to:
68878115.gif

15039744.gif

That when converted to base 2 will be of the form:
11955309.gif

Now notice that all of the powers in the
74709338.gif

base system occur in the base 2 system in n to n digits. And because in base 2 in a gap of n digits you can represent exactly
74709338.gif

different numbers (0 included) this exact gap of n digits corresponds to one digit on the
74709338.gif

base system.
Example
For n=3 base 8 (octal).
From binary to octal:
12699784.gif

From octal to binary:
80589847.gif

For n=4 base 16 (hexadecimal).
From binary to hexadecimal:
31820555.gif

From hexadecimal to binary:
36354147.gif

Note: Similar types of quick conversion between other types of bases systems are possible for those that fall under the same type of analysis.

I will try to cover binary operations and bolean logic later
 
arg-fallbackName="blinddesign"/>
thanks for all the replies so far but can anyone see if the post where i went through what i should do after the decimal point and see if it's right?
thanks.
in other news, i have started writing in a secret code using binary. it's an alpha-numeric code in binary with two lines on the start of a word and one line at the beginning and end of a letter. it looks fucked up here because of lack of appropriate symbols but it looks good written.

"¡ = start and end of a word
"  = start and end of letter
Q = "0" at the end of a letter
for example:
"¡ "¡10Q " 11"  " 010"  " 0"¡ "¡100"  " 11"  " 010Q
I L O V E Y O U

and you can be really sly and push it all together

"¡"¡10Q" 11" " 010" " 0"¡"¡100" " 11" " 010Q

now who's gonna understand that?
 
Back
Top