0% found this document useful (0 votes)
62 views

Lesson 01 - Data Representation

This document discusses various data representation formats used in computer programming. It describes binary, hexadecimal, and octal number systems. It also explains units like bits, bytes, and words. Finally, it summarizes different numeric representation formats including binary-coded decimal, unpacked decimal, packed decimal, and fixed-point and floating-point representations of negative and positive numbers.

Uploaded by

Mika Salvo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views

Lesson 01 - Data Representation

This document discusses various data representation formats used in computer programming. It describes binary, hexadecimal, and octal number systems. It also explains units like bits, bytes, and words. Finally, it summarizes different numeric representation formats including binary-coded decimal, unpacked decimal, packed decimal, and fixed-point and floating-point representations of negative and positive numbers.

Uploaded by

Mika Salvo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Data Representation

Computer Programming 1
Number System
• Binary Numbers
These are base 2 numbers represented
by 0 and 1.

•Bit (binary bit) is 1 digit of the binary number system. It is


the smallest unit that represents data inside the computer.

•Byte is a unit that represents 1 character or number with 8


bits.

•Word is the number of adjacent bits that can be manipulated


as a unit. It is an ordered set of characters which is treated,
stored, and transported by computer circuits.

Computer Programming 1
Number System
• Hexadecimal Numbers
These are base 16 numbers represented
by 0 to 9 and the letters A to F.

• Octal Numbers
These are base 8 numbers represented
by 0 to 7.

• Radix and Weight


Radix refers to the base of a number system, and
the weight refers to the place value of a digit in a set of
numbers of a particular number system.

Computer Programming 1
Auxiliary Units
and Power
Representation

Computer Programming 1
Number System

Unit Symbol Exponent Notation Remarks


T(tera) 1012 240
G(Giga) 109 230
M(mega) 106 220
k(kilo) 103 210
m(milli) 10-3 1/1000
µ(micro) 10-6 1/1,000,000
n(nano) 10-9 1/1,000,000,000
p(pico) 10-12 1/1,000,000,000,000

Computer Programming 1
Radix
Conversion

Computer Programming 1
Number System

• Binary to Decimal
• Decimal to Binary
• Binary to Hexadecimal
• Hexadecimal to Binary
• Binary to Octal
• Octal to Binary

Computer Programming 1
Operations on
Binary Numbers

Computer Programming 1
Number System

• Addition of Binary Numbers


0+0=0
0+1=1
1+0=1
1 + 1 = 10

Computer Programming 1
Number System

• Subtraction of Binary Numbers


0-0=0
0 - 1 = -1
1-0=1
1-1=0

Computer Programming 1
Numeric
Representation
Format

Computer Programming 1
Numeric Representation Format
Numeric Data
• Decimal Numbers
– Binary-Coded Decimal (BCD) Code
– Unpacked Decimal Format
– Packed Decimal Format
• Binary Numbers
– Negative Integers
• Absolute Value Representation
• Complement Representation
– Fixed Point
– Floating Point
Character Data

Computer Programming 1
Numeric Representation Format

• Binary-Coded Decimal (BCD) Code


BCD uses 4-bit binary digits that
corresponds to the numbers 0 to 9 of the
decimal system.

Computer Programming 1
Numeric Representation Format

• Unpacked Decimal Format


The unpacked decimal format represents
the values from 0 to 9 in the least significant 4
bits of 1 byte, and in the most significant 4 bits,
which are called zoned bits. The sign of the
decimal number is stored in the zoned bits of
the least significant 4 bits.

Computer Programming 1
Numeric Representation Format

• Packed Decimal Format


In the packed decimal format, 1 byte
represents a numeric value of 2 digits and the
least significant 4 bits represent the sign.

Computer Programming 1
Numeric Representation Format

• Negative Integers
– Absolute Value Representation
Here, the first bit represents the sign,
and the seven other bits represent the
numeric value. The range of numeric values
that can be represented in decimal digits is
from -127 to 127.

Computer Programming 1
Numeric Representation Format

• Negative Integers
– Complement Representation
The complement is the number that
indicates the quantity by which a numeric
value falls short of a specific numeric value.

Computer Programming 1
Numeric Representation Format

• Fixed Point
The fixed point is a data representation
format used mainly when integer type data is
processed, therefore, it is also called integer
type. The range of representable values is
-215 to (215-1) = -32,768 to 32,767.

Computer Programming 1
Numeric Representation Format

• Floating Point
The floating point format is used to
represent real number data type.

Computer Programming 1

You might also like