1 29 2024 Data Types and Representation Lab - Jsheepy101/SYS-140 GitHub Wiki

Downloadable File

Lab Journal Entry.docx

Document Text

  1. Converting binary to decimal is easier than it sounds. Let's first take a binary number to use as an example. 1010 To turn this number into decimal, we need to first see which numbers are โ€œonโ€. Since the first and third are on, it is essentially 8+2, which in decimal is 10. Binary basically doubles itself each time., so instead of going 1, 10, 100 like decimal, it instead foes 1, 2, 4, 8, etc. Except each digit can either be โ€œonโ€ or โ€œoffโ€ If the digit is a 1, then it is on, if it is 0, off. We only count the numbers of the digits that are on. Which is why we only count the 8 and the 2 places.

  2. Hexadecimal to decimal is a little harder. Hexadecimal is base 16 instead of decimals base 10. What does that mean exactly?

Instead of going 1โ€™s, 10โ€™s, 100โ€™s, Hexadecimal goes 1โ€™s, 16โ€™s, 160โ€™s It also does not count to 16, replacing 10-15 with letters of the alphabet instead. Decimal looks like 1 2 3 4 5 6 7 8 9 10 Hexadecimal looks like 1 2 3 4 5 6 7 8 9 9 a b c d e f To convert, we first need a hexadecimal number We will convert 2C to decimal 2C = 2 * 16 + 13 * 1 To sum it up, the 2 is in the 16โ€™s place, so we multiply 2 times 16 to get 32. Then in the one place, is C (aka 13) so we multiply 1 times 13. Now we add them together to get 45.

  1. I noticed weird patterns with the float toy functions we messed around with. I had never used float toy numbers before, but it kept getting smaller and smaller, like half, quarter, 1/16. When I enabled them they changed the numbers exponentially. The binary number would become something like 10^-60 or something absurd.