1.4.1 Data Types
暂无描述。系统推荐的高质量记忆内容,适合每天坚持背诵学习。
卡片预览 (21 张)
How do number systems work?
They are referred to by their base; the number of symbols used to form combinations
Three examples of number systems?
Denary Binary Hexadecimal
What base is hexadecimal?
16 Using values 0-9, and then A-F
Pros and Cons of denary?
Easy to understand Hard to use in electronics
Pros and cons of Hexadecimal?
It is easier to read and remember than binary It is quicker to type than binary, hence less chance of typing errors. Easy to transcribe to and from binary Hard to use with Circuitry
Pros and cons of Binary?
Simple to use with circuitry Difficult to read for humans
Uses of hexadecimal?
Used to represent colors (#RRGGBB)- each hex value represents the intensity of one of three color channels Used to define MAC addresses
What is fixed point binary?
When binary numbers use a specifically placed binary point.
What’s sign and magnitude?
A binary value where the MSB acts as a sign bit: 1 = Negative, 0 = Positive
How to represent a number in two’s complement?
The MSB is negative, usually -128
How do you convert a positive number to a negative using two’s compliment?
Find binary value Flip all bits Add 1
What are binary floating point numbers?
The binary standard form that consists of the following: A sign bit and mantissa, represented in 2’s compliment An Exponent represented in 2’s compliment
How to normalize a floating point number?
Check the mantissa sign to see if positive or negative Find the first bit which has a value opposite to the sign bit Place binary point in front of this bit Adjust the exponent, so the number maintains the same value.
How to convert a negative denary number to a Floating point number?
Calculate two’s compliment Convert to fixed point Normalize
How to add Floating point numbers?
Normalize both numbers, making sure both exponents are the same Add the mantissa Normalize the result When subtracting: Convert the second number into a 2’s compliment negative value and do the same thing
How to make a logical shift right?
Shift every value rightward Move LSB into carry bit Pad with 0
How to make an arithmetic shift right?
Pad front with MSB to preserve sign bit Shift all other bits rightward Shift LSB into carry bit
How to make an arithmetic shift left?
Pad the end with a 0 Shift all other bits left Shift MSB into carry bit (not preserved)
How to multiply binary values?
Use arithmetic shifts and add them together
How to make a circular shift left
Ending with the 2nd MSB and shift all left pad the end with MSB.
How to make an circular shift right?
Moves the bits of a binary number to the right, with the rightmost bit wrapping around to the leftmost position