Week 4 Lec 1
Week 4 Lec 1
Amna kosar
► fundamental quantity of representing some information is called a signal. It does not matter what
the information is i-e: Analog or digital information. In mathematic
► signal could be an analog quantity that means it is defined with respect to the time. It is a
continuous signal. These signals are defined over continuous independent variables. They are
difficult to analyze, as they carry a huge number of values , a signal is a function that conveys
some information.
► compared to analog signals, digital signals are very easy to analyze. They are discontinuous
signals. They are the appropriation of analog signals.
► The word digital stands for discrete values and hence it means that they use specific values to
represent any information. In digital signal, only two values are used to represent something i-e: 1
and 0 (binary values). Digital signals are less accurate then analog signals because they are the
discrete samples of an analog signal taken over some period of time
► Modern computers store and process information represented as 2-valued signals. These lowly binary digits, or bits,
form the basis of the digital revolution We consider the three most important representations of numbers.
► We consider the three most important representations of numbers. Unsigned encodings are based on traditional
binary notation, representing numbers greater than or equal to 0.
► Two’s-complement encodings are the most common way to represent signed integers, that is, numbers that may be
either positive or negative.
► Floating-point encodings are a base-two version of scientific notation for representing real numbers. Computers
implement arithmetic operations, such as addition and multiplication, with these different representations
► A signed integer is a 32-bit datum that encodes an integer in the range [-2147483648
to 2147483647]. An unsigned integer is a 32-bit datum that encodes a nonnegative integer
in the range [0 to 4294967295]. The signed integer is represented in twos complement
notation.
► Computer representations use a limited number of bits to encode a number, and hence some operations can overflow when the
results are too large to be represented. This can lead to some surprising results. For example, on most of today’s computers
(those using a 32-bit representation of data type int), computing the expression
► 200 * 300 * 400 * 500
► yields −884,901,888. This runs counter to the properties of integer arithmetic— computing the product of a set of positive
numbers has yielded a negative result. On the other hand, integer computer arithmetic satisfies many of the familiar properties of
true integer arithmetic. For example, multiplication is associative and commutative, so that computing any of the following C
expressions yields −884,901,888:
► (500 * 400) * (300 * 200)
► ((500 * 400) * 300) * 200
► ((200 * 500) * 300) * 400
► 400 * (200 * (300 * 500))
► Associative
► the associative property is a property of some binary operations, which means that
rearranging the parentheses in an expression will not change the result
► Commutative
► binary operation is commutative if changing the order of the operands does not change
the result. It is a fundamental property of many binary operations.
► Floating point
► a number's radix point (decimal point, or, more commonly in computers, binary
point) can "float“.
► Floating point arithmetic includes Multiplication, division, addition and subtraction.
► Floating-point arithmetic has altogether different mathematical properties. The product of a set of positive numbers will
always be positive, although overflow will yield the special value +∞. For example, the C expression
► E is a mathematical constant
► (3.14+1e20)-1e20 will evaluate to 0.0 on most machines, while 3.14+(1e20-
► 1e20) will evaluate to 3.14. The
different mathematical properties of integer vs. floating-point arithmetic stem from the difference in how they handle
the finiteness of their representations—integer representations can encode a comparatively small range of values, but do
so precisely, while floating-point representations can encode a wide range of values, but only approximately.
► Rather than accessing individual bits in memory, most computers use blocks of eight bits, or bytes, as the smallest
addressable unit of memory
► A machine level program views memory as a very large array of bytes, referred to as virtual memory.
► Every byte of memory is identified by a unique number, known as its address, and the set of all possible addresses
is known as the virtual address space. As indicated by its name, this virtual address space is just a conceptual image
presented to the machine-level program.
► A single byte consists of 8 bits. In binary notation, its value ranges from 00000000 to 11111111 we write bit patterns
as base-16, or hexadecimal numbers.
► Hexadecimal (or simply “hex”) uses digits ‘0’ through ‘9’ along with characters ‘A’ through ‘F’ to represent 16
possible values
► The characters ‘A’ through ‘F’ may be written in either upper or lower case. For example, we could write the number
FA1D37B16 as 0xFA1D37B, as 0xfa1d37b, or even mixing upper and lower case, e.g., 0xFa1D37b
► For example, suppose you are given the number 0x173A4C. You can convert this to binary format by expanding each
hexadecimal digit, as follows :
► Hexadecimal 1 7 3 A 4 C
► Binary 0001 0111 0011 1010 0100 1100
► This gives the binary representation 000101110011101001001100.
► Conversely, given a binary number 1111001010110110110011, you convert it to hexadecimal by first splitting it into
groups of 4 bits each. Note, however, that if the total number of bits is not a multiple of 4, you should make the leftmost
group be the one with fewer than 4 bits, effectively padding the number with leading zeros. Then you translate each
group of 4 bits into the corresponding hexadecimal digit: Binary 11 1100 1010 1101 1011 0011
► Hexadecimal 3 C A D B 3
► Every computer has a word size, indicating the nominal size of integer and pointer data. Since a virtual address is
encoded by such a word, the most important system parameter determined by the word size is the maximum size of
the virtual address space. That is, for a machine with a w-bit word size, the virtual addresses can range from 0 to 2w −
1, giving the program access to at most 2w bytes.
► Most personal computers today have a 32-bit word size. This limits the virtual address space to 4 gigabytes (written
4 GB), that is, just over 4 × 10 9 bytes.
► Consequently, high-end machines with 64-bit word sizes are becoming increasingly
common as storage costs decrease. As hardware costs drop over time, even desktop and
laptop machines will switch to 64-bit word sizes, and so we will consider the general case
of a w-bit word size, as well as the special cases of w = 32 and w = 64.
► Memory unit is the amount of data that can be stored in the storage unit.
► Bit 0 and 1
► Bytes 8 bits
► Word
► A computer word, like a byte, is a group of fixed number of bits processed as a unit, which
varies from computer to computer but is fixed for each computer.
► The length of a computer word is called word-size or word length. It may be as small as 8
bits or may be as long as 96 bits
► Computers and compilers support multiple data formats using different ways to encode
data, such as integers and floating point, as well as different lengths.
► The C language supports multiple data formats for both integer and floating point data.
The C data type char represents a single byte
Q&A