Page 1 of 1

Reputation:

Binary Number in Arithmetic

Posted 23 February 2010 - 08:59 AM

Hey guys

just now i learned about Binary Numbers. For 8 bit, i know that it'll produce up to 255 characters; and number (0-9) are among those characters which are listed from decimal 48 to 57. in the same topic, my lecturer also taught about how to calculate numbers in binary form. i've questions...

1. if a binary number able to be used up to 255 times, how about if i've numbers 261 and 300 to be calculated.
2. is number 12 for example; will be written in this form: 00001010 or in this form: 00110001 (1) 00110010 (2) when i want to use the number for any calculation.

tq

Is This A Good Question/Topic? 0

Replies To: Binary Number in Arithmetic

#2 dorknexus

Reputation: 1272
• Posts: 4,625
• Joined: 02-May 04

Re: Binary Number in Arithmetic

Posted 23 February 2010 - 09:09 AM

Most modern computers are 32 or 64 bit architectures so you have the ability to manipulate relatively large numbers natively.

I don't really understand what you are asking for #2 so could you elaborate ? None of the binary numbers you gave are equivalent to 12 in base 10.

This post has been edited by Dark_Nexus: 23 February 2010 - 09:11 AM

Reputation:

Re: Binary Number in Arithmetic

Posted 23 February 2010 - 09:37 AM

Dark_Nexus, on 23 February 2010 - 08:09 AM, said:

Most modern computers are 32 or 64 bit architectures so you have the ability to manipulate relatively large numbers natively.

I don't really understand what you are asking for #2 so could you elaborate ? None of the binary numbers you gave are equivalent to 12 in base 10.

is it? sorry coz i really confuse with binary numbers actually, i was taught that

2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
0 0 0 0 1 1 0 0 => hehe... wrong calculation i guess... shouldn't this equal to 12?
sory if i'm wrong... i don't even know whether this is wt hv been taught to me or i understand it in another way around... lol!

00110001 00110010 => i converted this from http://www.roubaixin...ary_To_Text.asp

as you can see, 00001100 contains 8 bit which i guess; is referred to any other character in Ascii Table. it's different with the second one (00110001 00110010) which the first binary really represent number 1 and the second binary represents number 2. as computer will do some math in ALU, which form will be used to do the math? the first or the second form?

example:
12 + 13 = 25

12 13 25
00001100 + 00001101 = 00011001
OR
1 2 1 3 2 5
00110001 00110010 + 00110001 00110011 = 00110010 00110101

which one will be used for calculation?

#4 dorknexus

Reputation: 1272
• Posts: 4,625
• Joined: 02-May 04

Re: Binary Number in Arithmetic

Posted 23 February 2010 - 09:42 AM

ASCII and binary are two different things. Binary is just a base-2 number system. ASCII is an encoding format for characters. The CPU will work with the first form of the binary representation of 12.

Reputation:

Re: Binary Number in Arithmetic

Posted 23 February 2010 - 09:56 AM

owh~! TQ

but... in java programming for example...
```String x = "12";
int y = Integer.parseInt(x);
```

is this mean that we ask the CPU to convert 0011000100110010 to 00001100 so that we can use it for calculation?

#6 dorknexus

Reputation: 1272
• Posts: 4,625
• Joined: 02-May 04

Re: Binary Number in Arithmetic

Posted 23 February 2010 - 09:58 AM

Exactly.

#7 calvinthedestroyer

• D.I.C Lover

Reputation: 172
• Posts: 1,932
• Joined: 13-October 07

Re: Binary Number in Arithmetic

Posted 24 February 2010 - 09:44 AM

If you want to calculate with the number 261 on an 8-bit computer system, the system will double the amount of data transfers that it will normally do by using two of its 8 bit registers AL (A low) and AH (A High) Both of these registers are 8 bits in size, and by using both of these the computer can store the 16 bit number 261. The CPU will have to load the lower 8 bits of the number first, into AL and then the higher 8 bits of the number into AH.