• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

help with binary numbers

Joined
Apr 26, 2008
Messages
1,126 (0.19/day)
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
i can do the alphabet in binary but the numbers after ten are confusing me
for example im not sure if, say for instance fifteen would be written as 1111 or 1010 101.:confused:
 

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
26,937 (3.72/day)
Processor Ryzen 7 5700X
Memory 48 GB
Video Card(s) RTX 4080
Storage 2x HDD RAID 1, 3x M.2 NVMe
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 10 64-bit
1111 = 8 +4 + 2 + 1

15 is especially easy since it's 16 minus 1 .. 16 is 1000 so one less is 1111 (remove leading 1 and make all other bits 1)
 
Joined
Apr 26, 2008
Messages
1,126 (0.19/day)
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
if 16 is 10000 then i understand 15 being 1111, but what do you mean by
1111 = 8+ 4+ 2 + 1
 
Joined
Jun 28, 2008
Messages
1,668 (0.29/day)
Location
Newcastle
Processor Intel Core i5 3570K
Motherboard MSI H61m-P31/w8
Cooling Stock
Memory 2*8GB DDR3
Video Card(s) XFX HD7850
Case Coolermaster Elite 330
Audio Device(s) Realtek HD audio
Power Supply Corsair RM650
Software Windows 10
I think that 1111 = 15 because the first one represents 8 and then the second 1 represents half the previous one, my friend was trying to explain it to me but he may have been wrong.
 
Joined
Mar 17, 2007
Messages
259 (0.04/day)
Location
Massachusetts
Processor FX-8350
Motherboard Gigabyte GA-990FXA-UD3
Cooling Corsair H60
Memory 16GB G.Skill Ripjaws
Video Card(s) XFX 7870
Storage 120GB OCZ SSD, 2x1TB storage
Display(s) Asus 27" IPS, Samsung 23" secondary
Case Cooler Master Cosmos
Power Supply Corsair 650w
Software Win7 Ultimate
Keep in mind that the numbers are always block of 4. 0000 1111 would be 15, and 0001 0000 would be 16. To represent the alphabet, you would need at least 2 blocks of 4, as there are more than 16 letters (given 0000 stands for something). There are actually 52 characters (2 cases), as well as symbols, so 8 bits are enough to cover them, giving you 255 (256) different combinations. you can't just leave out 0's and still be 100% clear. So 0 would be 0000 0000, and 255 = 1111 1111

0100 0111
0110 1111
0110 1111
0110 0100
0010 0000
0100 1100
0111 0101
0110 0011
0110 1011
0010 0001

Good Luck!

Also, Wizzard was explaining the basics of binary. Each digit represent a power of 2. for example,
0010 = 2
Quite literally, this means:
0 0 1 0 = 2
0*(2^3) + 0*(2^2) + 1*(2^1) + 0*(2^0)

likewise for 1111 =15
1*(2^3) + 1*(2^2) + 1*(2^1) + 1*(2^0) = 15
8+4+2+1 = 15

Expand that to 8 places, and you have enough digits to represent the alphabet, and then some.
1000 1000
= 1*(2^7) + 1*(2^3)
= 128 + 8
= 136
 
Last edited:
Joined
Aug 24, 2007
Messages
443 (0.07/day)
Location
BY-S36
System Name Bitch / Dogma
Processor 955 BE @ 3.8Gig / 9850 @stock
Video Card(s) 8800 GTX 512 / 4890
Storage 8 x Samsung F2 1.5TB, 8 x Seagate 500s
Display(s) Acer 24 / Dell 24
Case Lian li / Akasa
Software Win server 2008 / Win 7
16 8 4 2 1 = value for each binary digit
---------------------------------------------
1 0 1 0 0 = 16 + 4 = 20

0 1 1 1 1 = 8 + 4 + 2 + 1 = 15


This is also the best way to think of IP addresses, especially when using/understanding subnet masks eg:

192.168.0.1 (decimal) with the mask 255.255.0.0 (decimal)

192.168.0.1 = 11000000.10101000.00000000.00000001
255.255.0.0 = 11111111.11111111.00000000.00000000

The mask indicates that all bits = 1 are the network address and all set to zero are host addresses.

Network = 192.168.0.0
Hosts = 192.168.0.1 thru 192.168.255.254
 
Joined
Apr 26, 2008
Messages
1,126 (0.19/day)
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
now i get turning binary to decimels like
0010 1010=0+2+0+8+0+32+0+0
=42

0000 1111=1+2+4+8+0+0+0+0
=15

but is there no easier way to go from decimel to binary other than working out a big sum
 
Joined
Aug 30, 2006
Messages
7,193 (1.12/day)
System Name ICE-QUAD // ICE-CRUNCH
Processor Q6600 // 2x Xeon 5472
Memory 2GB DDR // 8GB FB-DIMM
Video Card(s) HD3850-AGP // FireGL 3400
Display(s) 2 x Samsung 204Ts = 3200x1200
Audio Device(s) Audigy 2
Software Windows Server 2003 R2 as a Workstation now migrated to W10 with regrets.
15 is 1111 in binary, but is 0001 0101 in BCD (binary coded decimal). BCD takes each digit and codes it separately. As you can see, it is quicker to convert decimal to BCD and vice versa. You can also do math in BCD on many CPUs. So BCD is often used by machine code programmers when doing something "quick" without math libraries.

While math in binary is faster and more efficient (bigger numbers in less memory) the problem is translating from binary to decimal and vice versa. Its a PITA to code.

You will find ALL (or nearly all) coin-op arcade games from the 80's and 90's used BCD for their "scores" and "high scores".
 
Joined
Aug 30, 2006
Messages
7,193 (1.12/day)
System Name ICE-QUAD // ICE-CRUNCH
Processor Q6600 // 2x Xeon 5472
Memory 2GB DDR // 8GB FB-DIMM
Video Card(s) HD3850-AGP // FireGL 3400
Display(s) 2 x Samsung 204Ts = 3200x1200
Audio Device(s) Audigy 2
Software Windows Server 2003 R2 as a Workstation now migrated to W10 with regrets.
What is the number 1111 1111? The answer is -1. If you are working with signed 8-bit binary.
 
Joined
Mar 17, 2007
Messages
259 (0.04/day)
Location
Massachusetts
Processor FX-8350
Motherboard Gigabyte GA-990FXA-UD3
Cooling Corsair H60
Memory 16GB G.Skill Ripjaws
Video Card(s) XFX 7870
Storage 120GB OCZ SSD, 2x1TB storage
Display(s) Asus 27" IPS, Samsung 23" secondary
Case Cooler Master Cosmos
Power Supply Corsair 650w
Software Win7 Ultimate
15 is 1111 in binary, but is 0001 0101 in BCD (binary coded decimal). BCD takes each digit and codes it separately. As you can see, it is quicker to convert decimal to BCD and vice versa. You can also do math in BCD on many CPUs. So BCD is often used by machine code programmers when doing something "quick" without math libraries.

While math in binary is faster and more efficient (bigger numbers in less memory) the problem is translating from binary to decimal and vice versa. Its a PITA to code.

You will find ALL (or nearly all) coin-op arcade games from the 80's and 90's used BCD for their "scores" and "high scores".

Indeed using standard binary is a PITA. Had to take an entire course on machine code using an lc3 emulator. We used straight up binary and it was terrible, no idea how I passed the course.
 

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
26,937 (3.72/day)
Processor Ryzen 7 5700X
Memory 48 GB
Video Card(s) RTX 4080
Storage 2x HDD RAID 1, 3x M.2 NVMe
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 10 64-bit
15 divide by 2 = 7 remainder 1
7 divide by 2 = 3 remainder 1
3 divide by 2 = 1 remainder 1
1 divider by 2 = 0 remainder 1

-----> 1111
 
Joined
Aug 30, 2006
Messages
7,193 (1.12/day)
System Name ICE-QUAD // ICE-CRUNCH
Processor Q6600 // 2x Xeon 5472
Memory 2GB DDR // 8GB FB-DIMM
Video Card(s) HD3850-AGP // FireGL 3400
Display(s) 2 x Samsung 204Ts = 3200x1200
Audio Device(s) Audigy 2
Software Windows Server 2003 R2 as a Workstation now migrated to W10 with regrets.
Please use your "formula" to convert 16. ;)
 

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
26,937 (3.72/day)
Processor Ryzen 7 5700X
Memory 48 GB
Video Card(s) RTX 4080
Storage 2x HDD RAID 1, 3x M.2 NVMe
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 10 64-bit
16 / 2 = 8 0
8 / 2 = 4 0
4 / 2 = 2 0
2 / 2 = 1 0
1 / 2 = 0 1
--> 10000

Edit: Typo fixed
 
Last edited:
Joined
Aug 24, 2007
Messages
443 (0.07/day)
Location
BY-S36
System Name Bitch / Dogma
Processor 955 BE @ 3.8Gig / 9850 @stock
Video Card(s) 8800 GTX 512 / 4890
Storage 8 x Samsung F2 1.5TB, 8 x Seagate 500s
Display(s) Acer 24 / Dell 24
Case Lian li / Akasa
Software Win server 2008 / Win 7
Joined
Jan 5, 2007
Messages
1,143 (0.18/day)
Location
New York
System Name AMD/ATI PHENOM MONSTER
Processor AMD Phenom II 965BE
Motherboard ASUS M4A785TD-V EVA
Cooling Air right know. Water later
Memory 4bg Corsair Dominator PC3 8500 9,9,9,24 2t timing
Video Card(s) Sapphire HD7950 Vapor-X
Storage 5x 500gb sata3.0 Seagate in RAID 0 - 2x 160gb Seagate for backup
Display(s) MAG INNOVISION 19in LCD 2ms 1600:1cr, 22in LED 2ms-5ms
Case Thermaltake Armor QuadFX edition
Power Supply 1000w Thermaltake toughpower
Software Windows 7 Ultimate 64bit
Benchmark Scores 3Dmark06 10712 single card and no oc, 12071 with cpu @ 2.8ghz and card oced, 13877 with crossfire.
You can convert from decimal to binary on the pc calculator. Also to convert a # to binary you could do a chart.

2^8 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
256 128 64 32 16 8 4 2 1
0 0 0 1 1 1 0 0 1


Lets say you want to convert the number 57 to binary. It all becomes addition find the numbers that will add up to 57 and put 1’s and the numbers that don’t work put 0’s. The 0’s on the left after the 1 don’t count so 57 in binary is 111001 or since its blocks of 4 0011 1001.

Look at the image because the numbers didn't come out right.
 

Attachments

  • untitled.JPG
    untitled.JPG
    13.8 KB · Views: 403

Kreij

Senior Monkey Moderator
Joined
Feb 6, 2007
Messages
13,817 (2.21/day)
Location
Cheeseland (Wisconsin, USA)
Binary representation of real world objects can be useful at times.

Let's say that you have a beer in front of you that is full (0001) and a twelve pack sitting to your left.
You drink the beer resulting in a binary zero (catastrophe!) so you shift left and grab another resulting in a binary state of 0010.
You know that once you hit 1101 you are out of beer and will have to make a run to the store. This can be prevented by a little forthought at 1010

Pffft ... and people scoff at the usefulness of binary outside of computers.
 
Joined
Aug 30, 2006
Messages
7,193 (1.12/day)
System Name ICE-QUAD // ICE-CRUNCH
Processor Q6600 // 2x Xeon 5472
Memory 2GB DDR // 8GB FB-DIMM
Video Card(s) HD3850-AGP // FireGL 3400
Display(s) 2 x Samsung 204Ts = 3200x1200
Audio Device(s) Audigy 2
Software Windows Server 2003 R2 as a Workstation now migrated to W10 with regrets.
^^ Agree, There are only 10 types of people. Those that know binary, and those that dont.

(OMG thats an old one...)
 

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
26,937 (3.72/day)
Processor Ryzen 7 5700X
Memory 48 GB
Video Card(s) RTX 4080
Storage 2x HDD RAID 1, 3x M.2 NVMe
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 10 64-bit
You can convert from decimal to binary on the pc calculator. Also to convert a # to binary you could do a chart.

2^8 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
256 128 64 32 16 8 4 2 1
0 0 0 1 1 1 0 0 1


Lets say you want to convert the number 57 to binary. It all becomes addition find the numbers that will add up to 57 and put 1’s and the numbers that don’t work put 0’s. The 0’s on the left after the 1 don’t count so 57 in binary is 111001 or since its blocks of 4 0011 1001.

Look at the image because the numbers didn't come out right.

yes but thats a lot more complicated than my simple division method
 
Joined
Aug 30, 2006
Messages
7,193 (1.12/day)
System Name ICE-QUAD // ICE-CRUNCH
Processor Q6600 // 2x Xeon 5472
Memory 2GB DDR // 8GB FB-DIMM
Video Card(s) HD3850-AGP // FireGL 3400
Display(s) 2 x Samsung 204Ts = 3200x1200
Audio Device(s) Audigy 2
Software Windows Server 2003 R2 as a Workstation now migrated to W10 with regrets.
ROFL. OK

There are 11 types of people. Those that can count in binary and those that can't.
 
Joined
Jan 5, 2007
Messages
1,143 (0.18/day)
Location
New York
System Name AMD/ATI PHENOM MONSTER
Processor AMD Phenom II 965BE
Motherboard ASUS M4A785TD-V EVA
Cooling Air right know. Water later
Memory 4bg Corsair Dominator PC3 8500 9,9,9,24 2t timing
Video Card(s) Sapphire HD7950 Vapor-X
Storage 5x 500gb sata3.0 Seagate in RAID 0 - 2x 160gb Seagate for backup
Display(s) MAG INNOVISION 19in LCD 2ms 1600:1cr, 22in LED 2ms-5ms
Case Thermaltake Armor QuadFX edition
Power Supply 1000w Thermaltake toughpower
Software Windows 7 Ultimate 64bit
Benchmark Scores 3Dmark06 10712 single card and no oc, 12071 with cpu @ 2.8ghz and card oced, 13877 with crossfire.
now i get turning binary to decimels like
0010 1010=0+2+0+8+0+32+0+0
=42

0000 1111=1+2+4+8+0+0+0+0
=15

but is there no easier way to go from decimel to binary other than working out a big sum

Ya you could use the windows calculator. Go to view then scientific then type in the number you want converted and then go from Dec to Bin. That should be easier if your doing big numbers.
 

Kreij

Senior Monkey Moderator
Joined
Feb 6, 2007
Messages
13,817 (2.21/day)
Location
Cheeseland (Wisconsin, USA)
Hexidecimal FTW !!

11011110101011011011111011101111 = DEADBEEF

MMmmm... I smell steaks cooking !!!
 

Oliver_FF

New Member
Joined
Oct 15, 2006
Messages
544 (0.09/day)
Processor Intel q9400 @ stock
Motherboard Lanparty P45-T2RS
Cooling Zalman CNPS-9500
Memory 8GB OCZ PC2-6400
Video Card(s) BFG Nvidia GTX285 OC
Storage 1TB, 500GB, 500GB
Display(s) 20" Samsung T200HD
Case Antec Mini P180
Audio Device(s) Sound Blaster X-Fi Elite Pro
Power Supply 700w Hiper
Software Ubuntu x64 virtualising Vista
Speaking of Beef, i've got some serious qualms with whichever idiot coined the term "two's compliment" to read out a negative binary number...

You know, where you "invert all the bits and add 1" or whatever?

Well, instead of cacking around with that why not press the minus button on your calculator first?? idiot to the person that coined that term. At uni whenever negative numbers come up everyone starts talking about this two's compliment and I just feel like slapping them silly...

1100 1100 as a signed integer is number (-52):

Well, for the 'educated' your supposed to invert all the bits and add 1 to discover that:
0011 0011(inverted)
0011 0100(add the 1)
add that up, 32+16+4 = 52; then stick the minus sign in front of it...

Much simpler:
(-128)+64+8+4 = (-52)

[end-rant]
 
Joined
Aug 30, 2006
Messages
7,193 (1.12/day)
System Name ICE-QUAD // ICE-CRUNCH
Processor Q6600 // 2x Xeon 5472
Memory 2GB DDR // 8GB FB-DIMM
Video Card(s) HD3850-AGP // FireGL 3400
Display(s) 2 x Samsung 204Ts = 3200x1200
Audio Device(s) Audigy 2
Software Windows Server 2003 R2 as a Workstation now migrated to W10 with regrets.
Oliver, you need to think about how this is done in machine code. You have instructions on a CPU that handle binary arithmetic. You cant do "blackboard math" on a CPU. If you are interested go here:

http://6502org.wikidot.com/software-math
http://codebase64.org/doku.php?id=base:6502_6510_maths
http://forum.6502.org/viewtopic.php?p=6338&sid=5cffd0599b1bce4d5fb06420d4b27203
http://www.atarimax.com/freenet/fre.../7.TechnicalResourceCenter/showarticle.php?14

(I'm giving you links to 6502 code because that was one of the top 8-bit processors from the 70's and 80's ... and the foundation of college machine code math)

Until you see it in practice, it is conceptually difficult to know why it is done like this. You cant imagine how tough it was to program back then without compilers, IDEs, and math libraries that are standard today.
 
Top