2.3 Data Representation and Data Types (Binary, Hex, and Denary)

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/30

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

31 Terms

1
New cards

Bit

A bit is the smallest unit of data in computing. It is a binary digit that can hold either the value of 0 or 1.

2
New cards

Byte

A byte is a group of binary digits operated on as a unit. In most computer systems, a byte is made up of 8 bits.

3
New cards

Word

A word is the total number of bits that can be manipulated as a single unit by the CPU.

4
New cards

Boolean

A Boolean data type represents truth values and can only take on two possible values: true or false.
May be stored in a single Bit as 1 if true and 0 if false.

5
New cards

Character

A character data type is used to store a single character, such as a letter, digit, or symbol. Characters are often represented using character encoding standards like ASCII or Unicode.
ASCII Character: 1 byte (8 bits). ASCII characters range from 0 to 127.

6
New cards

String

A string is a sequence of characters used to represent text. Unlike single characters, strings can vary in length.
The storage requirement for a string depends on its length and the encoding used.
For example, a string of length nnn in ASCII would require nnn bytes.

7
New cards

Integer

An integer data type is used to store whole numbers (i.e., numbers without a fractional part). Integers can be signed (allowing negative values) or unsigned (positive values only).
The storage requirement is 8-bit (1 byte) Integer: Ranges from −128-128−128 to 127127127 (signed) or 000 to 255255255 (unsigned).

8
New cards

Real

A real (or floating-point) data type is used to represent numbers with fractional parts, allowing for the representation of decimal points.
The storage requirement is 32-bit(4 bytes)

9
New cards

Overflow error

An overflow error occurs when a binary value is too large to be stored in the bits available. (e.g., 128 for an 8-bit value)

10
New cards

Underflow error

An underflow error occurs when a number is too small to be stored in the bits available. e.g., 0.00005 for a 3-bit value

11
New cards

How to calculate absolute error

Absolute = original - new

12
New cards

How to calculate relative error

Relative = (absolute/original) * 100

13
New cards

Positive Whole Numbers (base 10) in Binary

The example in the picture represents 42 in 8-bit binary.

When representing a positive number in binary, it always starts from 0.

42 -> 00101010

This is wasteful, as zero can be represented twice

<p>The example in the picture represents 42 in 8-bit binary.</p><p>When representing a positive number in binary, it always starts from 0.</p><p>42 -&gt; 00101010</p><p></p><p><em>This is wasteful, as zero can be represented twice</em></p>
14
New cards

Negative Whole Numbers (base 10) in Binary

The example in the picture represents -42 in 8-bit binary.
When representing a negative number in binary, it always starts from 1.
-42 -> 11010110

<p>The example in the picture represents -42 in 8-bit binary.<br>When representing a negative number in binary, it always starts from 1.<br>-42 -&gt; 11010110</p>
15
New cards

2's Complement

Method for representing signed (positive, negative, and zero) integers.

-42 -> 11010110 (in two's complements)
-128+64+16+4+2 = -42

<p>Method for representing signed (positive, negative, and zero) integers.<br><br>-42 -&gt; 11010110 (in two's complements)<br>-128+64+16+4+2 = -42</p>
16
New cards

Arithmetic and Logical Left-shift of binary

Left-shift means you are multiplying the binary by 2

In Arithmetic left-shift, if the binary starts with 1 that is, it's minus, you will keep the minus when you left shift.
Example: -42 -> 11010110 will be become 10101100
-128+32+8+4 = -84

In Logical left-shift, if the binary starts with 1, it will become 0, that is, the binary will become positive.
Example: -42 -> 11010110 will become 01010100
64+16+4 = 84

17
New cards

Arithmetic and Logical Right-shift of binary

Right-shift means you are dividing the binary by 2

In Arithmetic right-shift, if the binary starts with 1 that is, it's minus, you will keep the minus when you left shift.
Example: -42 -> 1101011 will be become 11101011
-128+64+32+8+2+1 = -21

In Logical right-shift, if the binary starts with 1, it will become 0, that is, the binary will become positive.
Example: -42 -> 11010110 will become 00010101
16+4+1 = 21

18
New cards

Real Numbers

Numbers with decimal places like 2.5 or 3.141592654

19
New cards

Standard Form

Large numbers represented as Mantissa x 10^exponent
0.65625 X 2^6 represent 42

20
New cards

Exponent and Mantissa

Mantissa x 10^exponent
Mantissa must be between 0.5 and 1
0.5 <= Mantissa < 1

Exponent is part of a number indicating the power of the base

21
New cards

How to get exponent and mantissa

You will use a calculator to divide the number by 2 each time until you get an answer that's between 0.5 and 1. The answer is the mantissa. The number of 2 you use to get the answer is the exponent.

42 = 42 x 2^0 (no division)
42 = 21 x 2^2 (first division)
42 = 10.5 x 2^2 (second division)
42 = 5.25 x 2^3 (third division)
42 = 2.625 x 2^4 (fourth division)
42 = 1.3125 x 2^5 (fifth division)
42 = 0.65625 x 2^6 (sixth division)

22
New cards

16-bit Floating Point

16-bit floating point uses 8-bits for the Mantissa and 8-bits for the Exponent.
Both parts could use Sign & Magnitude or Two's Complement representation.

23
New cards

Representing Mantissa in binary

The image show how to represent a Mantissa of 0.65625

<p>The image show how to represent a Mantissa of 0.65625</p>
24
New cards

Representing Exponent in binary

The image show how to represent an exponent of 6

<p>The image show how to represent an exponent of 6</p>
25
New cards

16 bit floating point representation

knowt flashcard image
26
New cards

Real Number to fixed point binary

The image shows 25.57 in fixed point binary.

Convert the 25 to binary, then convert .75 using 1/2, 1/4 and so on.

<p>The image shows 25.57 in fixed point binary.<br><br>Convert the 25 to binary, then convert .75 using 1/2, 1/4 and so on.</p>
27
New cards

Difference between Floating Point and Fixed Point

Floating point
• It has set number of bits for mantissa and exponent
• trade-off between accuracy v range
• larger mantissa leads to greater accuracy
• larger exponent leading to greater range of numbers being represented
• It is not possible to represent zero.

Fixed point
• not flexible and has a set range and level of accuracy
• is less complex.

28
New cards

Hexadecimal (HEX)

Hexadecimal is base-16
There are 16 different characters available when using this system:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

A - 10
B -11
C - 12
D - 13
E - 14
F -15

29
New cards

Hex to denary (base 10)

AD9C
(10 x 4096) + (13 x 256) + (9 x 16) + (12 x 1)
40960 + 3328 + 144 + 12 = 44444

30
New cards

Base 10 to Hex

50672
50672/4096 = 12 - C
12 x 4096 = 49152
50672 - 49152 = 1520
1520/256 = 5 - 5
5 x 256 = 1280
1520 -1280 = 240
240/16 = 15 - F
15 x 16 = 240
240 - 240 = 0 - 0
50672 -> C5F0

31
New cards

Binary to Hex

10101101111011

Split into group of four

0010 1011 0111 1011

2B7B

When splitting up the Binary into group of 4, always start at the RIGHT