Arithmetic and Logical Operations
Data
Represents fundamental information such as numbers, characters, and other values.
Data are particular values that conform to specific types and structures
Examples of Simple Value Data (Primitives)
- Integers
- Floating-point numbers
- Characters
- Booleans
Transmission
Data is transmitted between components of a computer system electronically
Voltage
Electric potential difference: energy per unit charge.
Current
The rate of electric charge flow.
Binary
Most computers today are binary digital machines that electronically process data in the form of binary digits (bits)
Digital vs. Analog
Digital has a finite number of values, while analog has an infinite number of values.
Binary
Binary is a base-2 number system that uses two digits, 0 and 1. Therefore, it can be represented in 2 states.
Example
A low state can be represented as a voltage range of 0-0.8V, while a high state can be represented as a voltage range of 2-5V.
Bit
The basic unit of information in computing and digital communications, representing a single binary digit.
Grouping Bits
Bits are grouped into larger units to represent more complex data.
- Byte: 8 bits (representing 256 values)
- 10 bits: 1,024 values
- 12 bits: 4,096 values
- bits: values
Tip
To calculate the number of bits needed to represent values, use bits, for
Encoding
The process of converting one representation of data into another representation.
Weighted Positional Notation
Given a base and a set of digits, the value of a number is calculated as:
Base Systems
- Base-2: Binary
- Base-8: Octal
- Base-10: Decimal (most common)
- Base-16: Hexadecimal
- Base-64: Used in encoding
Most Significant Digit (MSD)
The digit that represents the largest value in a number.
Least Significant Digit (LSD)
The digit that represents the smallest value in a number.
Unsigned Integers
Unsigned integers are nonnegative integers that are represented in binary form.
Signed Integers
A data type to represent both positive and negative numbers.
Sign-Magnitude
The most significant bit (MSB) represents the sign of the number.
- 0: Positive
- 1: Negative
However, this method has two representations for zero.
One’s Complement
The negative of a number is represented by flipping all the bits.
However, this method has two representations for zero.
Two’s Complement
The negative of a number is represented by flipping all the bits and adding 1.
This method has only one representation for zero.
What is the 2's complement of the following (taking the 2's complement)
Two’s complement is the most common method for representing signed integers, as it is preferred for arithmetic operations.
Related: lecture-02, lecture-03, lecture-04, lecture-05
Source
Original retained in wisconsin-legacy.