The document discusses different number systems including binary, decimal, and hexadecimal. It explains that binary uses two digits (0,1), decimal uses ten digits (0-9), and hexadecimal uses sixteen digits (0-9 plus A-F). All of these systems are positional number systems where the value of each digit depends on its place value. The document then discusses binary addition and subtraction, two's complement representation for signed numbers, hexadecimal addition, and concepts like nibbles and bytes.
Reviewing number systems involves understanding various ways in which numbers can be represented and manipulated. Here's a brief overview of different number systems:
Decimal System (Base-10):
This is the most common number system used by humans.
It uses 10 digits (0-9) to represent numbers.
Each digit's position represents a power of 10.
For example, the number 245 in decimal represents (2 * 10^2) + (4 * 10^1) + (5 * 10^0).
Binary System (Base-2):
Used internally by almost all modern computers.
It uses only two digits: 0 and 1.
Each digit's position represents a power of 2.
For example, the binary number 1011 represents (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (1 * 2^0) in decimal, which equals 11.
Octal System (Base-8):
Less commonly used, but still relevant in some computer programming contexts.
It uses eight digits: 0 to 7.
Each digit's position represents a power of 8.
For example, the octal number 34 represents (3 * 8^1) + (4 * 8^0) in decimal, which equals 28.
Hexadecimal System (Base-16):
Widely used in computer science and programming.
It uses sixteen digits: 0 to 9 followed by A to F (representing 10 to 15).
Each digit's position represents a power of 16.
Often used to represent memory addresses and binary data more compactly.
For example, the hexadecimal number 2F represents (2 * 16^1) + (15 * 16^0) in decimal, which equals 47.
Each number system has its own advantages and applications. Decimal is intuitive for human comprehension, binary is fundamental in computing due to its simplicity for electronic systems, octal and hexadecimal are often used for human-readable representations of binary data in programming, particularly when dealing with memory addresses and byte-oriented data.
Understanding these number systems is essential for various fields such as computer science, electrical engineering, and mathematics, as they provide different perspectives on how numbers can be represented and manipulated.
Reviewing number systems involves understanding various ways in which numbers can be represented and manipulated. Here's a brief overview of different number systems:
Decimal System (Base-10):
This is the most common number system used by humans.
It uses 10 digits (0-9) to represent numbers.
Each digit's position represents a power of 10.
For example, the number 245 in decimal represents (2 * 10^2) + (4 * 10^1) + (5 * 10^0).
Binary System (Base-2):
Used internally by almost all modern computers.
It uses only two digits: 0 and 1.
Each digit's position represents a power of 2.
For example, the binary number 1011 represents (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (1 * 2^0) in decimal, which equals 11.
Octal System (Base-8):
Less commonly used, but still relevant in some computer programming contexts.
It uses eight digits: 0 to 7.
Each digit's position represents a power of 8.
For example, the octal number 34 represents (3 * 8^1) + (4 * 8^0) in decimal, which equals 28.
Hexadecimal System (Base-16):
Widely used in computer science and programming.
It uses sixteen digits: 0 to 9 followed by A to F (representing 10 to 15).
Each digit's position represents a power of 16.
Often used to represent memory addresses and binary data more compactly.
For example, the hexadecimal number 2F represents (2 * 16^1) + (15 * 16^0) in decimal, which equals 47.
Each number system has its own advantages and applications. Decimal is intuitive for human comprehension, binary is fundamental in computing due to its simplicity for electronic systems, octal and hexadecimal are often used for human-readable representations of binary data in programming, particularly when dealing with memory addresses and byte-oriented data.
Understanding these number systems is essential for various fields such as computer science, electrical engineering, and mathematics, as they provide different perspectives on how numbers can be represented and manipulated.
Chapter 2 Data Representation on CPU (part 1)Frankie Jones
This topic introduces the numbering systems: decimal, binary, octal and hexadecimal. The topic covers the conversion between numbering systems, binary arithmetic, one's complement, two's complement, signed number and coding system. This topic also covers the digital logic components.
Chapter 2 Data Representation on CPU (part 1)Frankie Jones
This topic introduces the numbering systems: decimal, binary, octal and hexadecimal. The topic covers the conversion between numbering systems, binary arithmetic, one's complement, two's complement, signed number and coding system. This topic also covers the digital logic components.
Overview of the fundamental roles in Hydropower generation and the components involved in wider Electrical Engineering.
This paper presents the design and construction of hydroelectric dams from the hydrologist’s survey of the valley before construction, all aspects and involved disciplines, fluid dynamics, structural engineering, generation and mains frequency regulation to the very transmission of power through the network in the United Kingdom.
Author: Robbie Edward Sayers
Collaborators and co editors: Charlie Sims and Connor Healey.
(C) 2024 Robbie E. Sayers
Hierarchical Digital Twin of a Naval Power SystemKerry Sado
A hierarchical digital twin of a Naval DC power system has been developed and experimentally verified. Similar to other state-of-the-art digital twins, this technology creates a digital replica of the physical system executed in real-time or faster, which can modify hardware controls. However, its advantage stems from distributing computational efforts by utilizing a hierarchical structure composed of lower-level digital twin blocks and a higher-level system digital twin. Each digital twin block is associated with a physical subsystem of the hardware and communicates with a singular system digital twin, which creates a system-level response. By extracting information from each level of the hierarchy, power system controls of the hardware were reconfigured autonomously. This hierarchical digital twin development offers several advantages over other digital twins, particularly in the field of naval power systems. The hierarchical structure allows for greater computational efficiency and scalability while the ability to autonomously reconfigure hardware controls offers increased flexibility and responsiveness. The hierarchical decomposition and models utilized were well aligned with the physical twin, as indicated by the maximum deviations between the developed digital twin hierarchy and the hardware.
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
2. 2
Base-N Number System
Base N
N Digits: 0, 1, 2, 3, 4, 5, …, N-1
Example: 1045N
Positional Number System
• Digit do is the least significant digit (LSD).
• Digit dn-1 is the most significant digit (MSD).
1 4 3 2 1 0
1 4 3 2 1 0
n
n
N N N N N N
d d d d d d
3. 3
Decimal Number System
Base 10
Ten Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Example: 104510
Positional Number System
Digit d0 is the least significant digit (LSD).
Digit dn-1 is the most significant digit (MSD).
1 4 3 2 1 0
1 4 3 2 1 0
10 10 10 10 1010
n
n
d d d d d d
4. 4
Binary Number System
Base 2
Two Digits: 0, 1
Example: 10101102
Positional Number System
Binary Digits are called Bits
Bit bo is the least significant bit (LSB).
Bit bn-1 is the most significant bit (MSB).
1 4 3 2 1 0
1 4 3 2 1 0
2 2 2 2 2 2
n
n
b b b b b b
5. 5
Definitions
nibble = 4 bits
byte = 8 bits
(short) word = 2 bytes = 16 bits
(double) word = 4 bytes = 32 bits
(long) word = 8 bytes = 64 bits
1K (kilo or “kibi”) = 1,024
1M (mega or “mebi”) = (1K)*(1K) = 1,048,576
1G (giga or “gibi”) = (1K)*(1M) = 1,073,741,824
6. 6
Hexadecimal Number System
Base 16
Sixteen Digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
Example: EF5616
Positional Number System
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 A
1011 B
1100 C
1101 D
1110 E
1111 F
1 4 3 2 1 0
16 16 16 16 1616
n
9. 9
Hex Digit Addition Table
+ 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 0 1 2 3 4 5 6 7 8 9 A B C D E F
1 1 2 3 4 5 6 7 8 9 A B C D E F 10
2 2 3 4 5 6 7 8 9 A B C D E F 10 11
3 3 4 5 6 7 8 9 A B C D E F 10 11 12
4 4 5 6 7 8 9 A B C D E F 10 11 12 13
5 5 6 7 8 9 A B C D E F 10 11 12 13 14
6 6 7 8 9 A B C D E F 10 11 12 13 14 15
7 7 8 9 A B C D E F 10 11 12 13 14 15 16
8 8 9 A B C D E F 10 11 12 13 14 15 16 17
9 9 A B C D E F 10 11 12 13 14 15 16 17 18
A A B C D E F 10 11 12 13 14 15 16 17 18 19
B B C D E F 10 11 12 13 14 15 16 17 18 19 1A
C C D E F 10 11 12 13 14 15 16 17 18 19 1A 1B
D D E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C
E E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D
F F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E
10. 10
1’s Complements
1’s complement (or Ones’ Complement)
To calculate the 1’s complement of a binary
number just “flip” each bit of the original
binary number.
E.g. 0 1 , 1 0
01010100100 10101011011
11. 11
Why choose 2’s complement?
if you try to subtract 4 from 6 (two positive numbers) you can 2's
complement 4 and add the two together 6 + (-4) = 6 - 4 = 2
This means that subtraction and addition of both positive and negative
numbers can all be done by the same circuit in the CPU..
12. 12
2’s Complements
2’s complement
To calculate the 2’s complement just calculate
the 1’s complement, then add 1.
01010100100 10101011011 + 1=
10101011100
Handy Trick: Leave all of the least significant
0’s and first 1 unchanged, and then “flip” the
bits for all other digits.
Eg: 01010100100 -> 10101011100
13. 13
Complements
Note the 2’s complement of the 2’s
complement is just the original number N
EX: let N = 01010100100
(2’s comp of N) = M = 10101011100
(2’s comp of M) = 01010100100 = N
14. 14
Two’s Complement Representation
for Signed Numbers
Let’s introduce a notation for negative digits:
For any digit d, define d = −d.
Notice that in binary,
where d {0,1}, we have:
Two’s complement notation:
To encode a negative number, we implicitly
negate the leftmost (most significant) bit:
E.g., 1000 = (−1)000
= −1·23 + 0·22 + 0·21 + 0·20 = −8
1
0
1
1
1
1
0
1
1
0
1
0
1
,
1
d
d
d
d
15. 15
Negating in Two’s Complement
Theorem: To negate
a two’s complement
number, just complement it and add 1.
Proof (for the case of 3-bit numbers XYZ):
1
)
( 2
2
YZ
X
YZ
X
1
1
)
1
)(
1
(
1
11
100
)
1
(
)
(
2
2
2
2
2
2
2
2
2
YZ
X
Z
Y
X
YZ
X
YZ
X
YZ
X
YZ
X
YZ
X
YZ
X
16. 16
Signed Binary Numbers
Two methods:
First method: sign-magnitude
Use one bit to represent the sign
• 0 = positive, 1 = negative
Remaining bits are used to represent the
magnitude
Range - (2n-1 – 1) to 2n-1 - 1
where n=number of digits
Example: Let n=4: Range is –7 to 7 or
1111 to 0111
17. 17
Signed Binary Numbers
Second method: Two’s-complement
Use the 2’s complement of N to represent
-N
Note: MSB is 0 if positive and 1 if negative
Range - 2n-1 to 2n-1 -1
where n=number of digits
Example: Let n=4: Range is –8 to 7
Or 1000 to 0111
21. 21
Notes:
“Humans” normally use sign-magnitude
representation for signed numbers
Eg: Positive numbers: +N or N
Negative numbers: -N
Computers generally use two’s-complement
representation for signed numbers
First bit still indicates positive or negative.
If the number is negative, take 2’s complement to
determine its magnitude
Or, just add up the values of bits at their positions,
remembering that the first bit is implicitly negative.
22. 22
Examples
Let N=4: two’s-complement
What is the decimal equivalent of
01012
Since MSB is 0, number is positive
01012 = 4+1 = +510
What is the decimal equivalent of
11012 =
Since MSB is one, number is negative
Must calculate its 2’s complement
11012 = −(0010+1)= − 00112 or −310
23. 23
Very Important!!! – Unless otherwise stated, assume two’s-
complement numbers for all problems, quizzes, HW’s, etc.
The first digit will not necessarily be
explicitly underlined.
24. 24
Arithmetic Subtraction
Borrow Method
This is the technique you learned in grade
school
For binary numbers, we have
0 - 0 = 0
1 - 0 = 1
1 - 1 = 0
0 - 1 = 1 with a “borrow”
1
25. 25
Binary Subtraction
Note:
A – (+B) = A + (-B)
A – (-B) = A + (-(-B))= A + (+B)
In other words, we can “subtract” B from A by
“adding” –B to A.
However, -B is just the 2’s complement of B,
so to perform subtraction, we
1. Calculate the 2’s complement of B
2. Add A + (-B)
29. 29
“16’s Complement” method
The 16’s complement of a 16 bit
Hexadecimal number is just:
=1000016 – N16
Q: What is the decimal equivalent of
B2CE16 ?
30. 30
16’s Complement
Since sign bit is one, number is negative.
Must calculate the 16’s complement to find
magnitude.
1000016 – B2CE16 = ?
We have
10000
- B2CE
35. 35
Sign Extension
Assume a signed binary system
Let A = 0101 (4 bits) and B = 010 (3 bits)
What is A+B?
To add these two values we need A and B to
be of the same bit width.
Do we truncate A to 3 bits or add an
additional bit to B?
36. 36
Sign Extension
A = 0101 and B=010
Can’t truncate A! Why?
A: 0101 -> 101
But 0101 <> 101 in a signed system
0101 = +5
101 = -3
37. 37
Sign Extension
Must “sign extend” B,
so B becomes 010 -> 0010
Note: Value of B remains the same
So 0101 (5)
+0010 (2)
--------
0111 (7)
Sign bit is extended
38. 38
Sign Extension
What about negative numbers?
Let A=0101 and B=100
Now B = 100 1100
Sign bit is extended
0101 (5)
+1100 (-4)
-------
10001 (1)
Throw away
39. 39
Why does sign extension work?
Note that:
(−1) = 1 = 11 = 111 = 1111 = 111…1
Thus, any number of leading 1’s is equivalent, so long
as the leftmost one of them is implicitly negative.
Proof:
111…1 = −(111…1) =
= −(100…0 − 11…1) = −(1)
So, the combined value of any sequence of
leading ones is always just −1 times the position
value of the rightmost 1 in the sequence.
111…100…0 = (−1)·2n
n
41. 41
Decimal to Binary Conversion
Method I:
Use repeated subtraction.
Subtract largest power of 2, then next largest, etc.
Powers of 2: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2n
Exponent: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 , n
210 2n
29
28
20 27
21 22 23 26
24 25
42. 42
Decimal to Binary Conversion
Suppose x = 156410
Subtract 1024: 1564-1024 (210) = 540 n=10 or 1 in the (210)’s position
Thus:
156410 = (1 1 0 0 0 0 1 1 1 0 0)2
Subtract 512: 540-512 (29) = 28 n=9 or 1 in the (29)’s position
Subtract 16: 28-16 (24) = 12 n=4 or 1 in (24)’s position
Subtract 8: 12 – 8 (23) = 4 n=3 or 1 in (23)’s position
Subtract 4: 4 – 4 (22) = 0 n=2 or 1 in (22)’s position
28=256, 27=128, 26=64, 25=32 > 28, so we have 0 in all of these positions
43. 43
Decimal to Binary Conversion
Method II:
Use repeated division by radix.
2 | 1564
782 R = 0
2|_____
391 R = 0
2|_____
195 R = 1
2|_____
97 R = 1
2|_____
48 R = 1
2|_____
24 R = 0
2|__24_
12 R = 0
2|_____
6 R = 0
2|_____
3 R = 0
2|_____
1 R = 1
2|_____
0 R = 1
Collect remainders in reverse order
1 1 0 0 0 0 1 1 1 0 0
44. 44
Binary to Hex Conversion
1. Divide binary number into 4-bit groups
2. Substitute hex digit for each group
1 1 0 0 0 0 1 1 1 0 0
0
Pad with 0’s
If unsigned number
61C16
Pad with sign bit
if signed number
45. 45
Hexadecimal to Binary Conversion
Example
1. Convert each hex digit to equivalent binary
(1 E 9 C)16
(0001 1110 1001 1100)2
46. 46
Decimal to Hex Conversion
Method II:
Use repeated division by radix.
16 | 1564
97 R = 12 = C
16|_____
6 R = 1
16|_____
0 R = 6
N = 61C 16