Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialjaquavieon brewer
Courses Plus Student 651 Pointswhat number is represented by the byte 00000011 and why ?
is there a better way to understand the binary numbering system and its placement values?
2 Answers
Raffael Dettling
32,999 Points2^0 = 1 + 2^1 = 2 => 3 the base is 2 and you increase the exponent from 0 to 7 in this case. You go upwards from right to left. More detailed (https://www.mathsisfun.com/binary-number-system.html)
Ryan Vaterlaus
9,462 PointsI believe it would be 3 if you are using binary, 1*2^0 + 1*2^1 = 1 + 2 = 3
If 00000011 was decimal which is base 10 it would be:
1*10^0 + 1*10^1 + 0*10^2 + 0*10^3 + 0*10^4 + 0*10^5 + 0*10^6 + 0*10^7
which is 1 + 10 + 0 + 0 + 0 + 0 + 0 + 0 = 11
but a byte stores values in binary which is base 2, so it is:
1*2^0 + 1*2^1 + 0*2^2 + 0*2^3 + 0*2^4 + 0*2^5 + 0*2^6 + 0*2^7
which in decimal is 1 + 2 + 0 + 0 + 0 + 0 + 0 + 0 = 3
sometimes the far left digit is checking whether it is negative or not, so instead of 0*2^7 being added, it is instead 0*(-1), but since that digit is 0 it does not matter which binary method you are using.