1/19
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What base are normal numbers in?
base 10 and the option of digits are 0-9
What does 0 and 1 mean in computers
0 = off
1 = on
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
What base do computers understand/work in
base 2
First method of converting to base 2
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
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
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)
what to write when number can’t be converted
error
what is hexidecimal code
base 16
How to represent digits >=10
use the alphabet starting from A=10, B=11, C=12, etc.
what is codemapping
mapping/assigning text to numbers
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
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
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
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
How to convert decimal numbers into binary:
Do the integer part normally
Take the decimal part and multiply by 2
When the product is greater than 1 put a 1
When the product is less than 1 put a 0
Repeat step 2, ignore the integer part and continue the previous step with the decimal part until there is no more decimal part
Put each digit from left to right, starting from the decimal point
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)
How to subtract binary numbers
A + B
Convert numbers to binary
Convert the B number into 2s compliment
Add A and Bs 2s compliment
Get the 2s compliment of the sum
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