2.2 Integer Representation Flashcards
Bit to Unsigned formula
Bit to two-complement equation
Equation for TMin
Equation for TMax
Two-complement to unsigned formula
Unsigned to two-complement equation
Range for T2U operation
TMin ≤ x ≤ Tmax
Range for U2T
0 ≤ u ≤ UMax
What happens when an operation in C is performed where one operand is signed and the other is unsigned
C implicitly casts the signed argument to unsigned and performs the operations assuming the numbers are nonnegative
Implicit casting
When an expression of one type is assigned to a variable of another
Explicit casting
Using the type between brackets
tx = (int) ux;
What is truncating
Reducing the number of bits representing a number
Rule for truncation of two-complement number
The most significant bit is converted to a sign bit