Binary Number and bases

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/19

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

20 Terms

1
New cards

What base are normal numbers in?

base 10 and the option of digits are 0-9

2
New cards

What does 0 and 1 mean in computers

0 = off

1 = on

3
New cards

what is a base

  • A numbering system used to represent values

  • the base is a numerical number represented in the subscript

  • the option of digits is always 0 to n-1

  • to convert the base multiply each digit by the basen starting from the ones digit where n = 0 and increases by one across the digits aka the tens digit n = 1 etc

  • then add the products together to get the number in that base

4
New cards

What base do computers understand/work in

base 2

5
New cards

First method of converting to base 2

knowt flashcard image
6
New cards

Quotient method of converting to base 2

  • only pay attention to integers

  • work right to left

  • if the number is odd put a 1, if the number is even put a 0

  • divide the original number wanting to be converted by 2, if the quotient is odd put a 1, if the number is even put a 0

    • only take the number, don’t round it and ignore the decimal

  • continue till the quotient is 0, when the quotient is 0 the number is finished

7
New cards

Remainder method of converting to base 2

  • only pay attention to integers

  • work right to left

  • if the number is odd put a 1, if the number is even put a 0

  • divide the original number wanting to be converted by 2, put the quotient which is 0 or 1

    • only take the number, don’t round it and ignore the decimal

  • continue till the quotient is 0

    • when the quotient is less than 1 multiply it byb the base and put it as 1

8
New cards

What is a more efficient way of converting bases with numbers of the same base but different powers

base 2 to base 8 = 21 to 23 which means every 3 digits of the base 2 number is equal to 1 digit in base 8

(add 0s at the end when there are leftover digits)

9
New cards

what to write when number can’t be converted

error

10
New cards

what is hexidecimal code

base 16

11
New cards

How to represent digits >=10

use the alphabet starting from A=10, B=11, C=12, etc.

12
New cards

what is codemapping

mapping/assigning text to numbers

13
New cards

how are images made/stored

  • made of pixels

  • each pixel has a color and color is stored in binary

  • for black and white, with 0s as black and 1s as white hence each pixel uses only 1 bit

  • for color images each pixel has a range of 0-255 of r, g, and, b. each pixel needs 24 bits, each in base 2 but better to represent in base 16

    • #RRGGBB

14
New cards

Sign magnitude to store +/- numbers

  • first digit shows whether they’re positive or negative,

    • 0 = positive

    • 1 = negative

  • while the rest of the digits represent what the number was

  • 11011= -11

15
New cards

1’s compliment to store +/- numbers

  • first digit shows whether they’re positive or negative,

    • 0 = positive

    • 1 = negative

  • flip the numbers i.e. every 0 becomes a 1 and vice versa

  • find the value of the flipped number

  • 11011 = -4

16
New cards

2’s compliment to store +/- numbers

  • first digit shows whether they’re positive or negative,

    • 0 = positive

    • 1 = negative

  • flip the numbers i.e. every 0 becomes a 1 and vice versa

  • add 1, addition is done normally but all numbers done in binary

    • the 1 was added to fix the issue from previous methods where there was +/- 0s

  • find the value of the new number

  • 11011 = -5

17
New cards

How to convert decimal numbers into binary:

  1. Do the integer part normally

  2. Take the decimal part and multiply by 2

    1. When the product is greater than 1 put a 1

    2. When the product is less than 1 put a 0

  3. Repeat step 2, ignore the integer part and continue the previous step with the decimal part until there is no more decimal part

  4. Put each digit from left to right, starting from the decimal point

18
New cards

Max range of numbers in n number of bits

  • Unsigned: 2^n-1

  • Sign magnitude & 1s compliment: -(2^n-1 - 1) to (2^n-1 - 1)

2s compliment: -(2^n-1) to (2^n-1 - 1)

19
New cards

How to subtract binary numbers

A + B

  1. Convert numbers to binary

  2. Convert the B number into 2s compliment

  3. Add A and Bs 2s compliment

  4. Get the 2s compliment of the sum

20
New cards

how to convert decimal binary numbers back to base 10

After the decimal point the base is raised to negative numbers starting from -1 in the 10s place, -2 in the 100s place and so on