Digital Principles and Computer Organization: Chapter 4: Combinational Circuits

Floating Point Numbers

1. IEEE Standard for Floating-Point Numbers, 2. Special Values, 3. Exceptions . 1. What are floating pointer numbers ? 2. Explain the representations of floating point numbers in detail. 3. Draw the format of floating point number. 4. Define IEEE floating point single and double precision standard. 5. What is denormal ? Define NaN ? 6. In conforming to the IEEE standard mention any four situations under which a processor sets dgn exception flag. 7. Define underflow and overflow.

Floating Point Numbers

• To accommodate very large integers and very small fractions, a computer must be able to represent numbers and operate on them in such a way that the position of the binary point is variable and is automatically adjusted as computation proceeds. In this case, the binary point is said to float and the numbers are called floating–point numbers.

• The floating point representation has three fields : sign, significant digits and exponent.

• Let us consider the number 1 1 1 1 0 1 . 1 0 0 0 1 1 0 to be represented in the floating point format.

• To represent the number in floating point format, first binary point is shifted to right of the first bit and the number is multiplied by the correct scaling factor to get the same value. The number is said to be in the normalized form and is given as


• It is important to note that the base in the scaling factor is fixed 2.

• The string of the significant digits is commonly known as mantissa.

• In the above example, we can say that,

Sign = 0

Mantissa = 1 1 1 0 1 1 0 0 1 1 0

Exponent = 5

• In floating point numbers, bias value is added to the true exponent. This solves the problem of representation of negative exponent.


1. IEEE Standard for Floating–Point Numbers

• The standards for representing floating point numbers in 32–bits and 64–bits have been developed by the Institute of Electrical and Electronics Engineers (IEEE), referred to as IEEE 754 standards. Fig. 4.14.2 shows these IEEE standard formats.

• The 32–bit standard representation shown in Fig. 4.14.2 (a) is called single–precision representation because it occupies a single 32–bit word. The 32–bits are divided into three fields as shown below :

(field 1) Sign            ← 1 – bit

(field 2) Exponent    ← 8–bits

(field 3) Mantissa     ← 23 – bits

• Instead of the signed exponent, E, the value actually stored in the exponent field is E' = E (scaling factor) + bias.


• In the 32–bit floating point system (single precision), bias is 127. Hence E' = E (scaling factor) + 127. This representation of exponent is also called as the excess–127 format.

• The end values of E', namely, 0 and 255, are used to indicate the floating point values of exact zero and infinity, respectively in single precision.

• Thus range of E' for normal values in single precision is 0 < E' < 255. This means that for 32–bit representation the actual exponent E is in the range –126 ≤ E ≤ 127.

• The 64–bit standard representation shown in Fig. 4.14.2 (b) is called a double–precision representation because it occupies two 32–bit words.

• The 64–bits are divided into three fields as shown below :

(field 1) Sign          ←     1 – bit

(field 2) Exponent  ←     1 – bit

(field 3) Mantissa   ←     52–bits

• In the double precision format value actually stored in the exponent field is given as

E' = E + 1023

• Here, bias value is 1023 and hence it is also called excess–1023 format.

• The end values of E', namely, 0 and 2047, are used to indicate the floating point exact values of exact zero and infinity, respectively.

• Thus the range of E' for normal values in double precision is 0 < E' < 2047. This means that for 64–bit representation the actual exponent E is in the range

– 1022 < E ≤ 1023.

Example: 1

 Represent 1259.12510 in single precision and double precision formats.

Solution :

Step 1 : Convert decimal number in binary format


 (1259)10 = (4EB)16

 (1259)10 = (100 1110 1011)2

(0.125)10 = (0.001)2

Binary number = 1 0 0 1 1 1 0 1 0 1 1 + 0 . 0 0 1 = 1 0 0 1 1 1 0 1 0 1 1 . 0  0 1

Step 2 : Normalize the number

1 0 0 1 1 1 0 1 0 1 1 . 0 0 1 = 1.0 0 1 1 1 0 1 0 1 1 0 0 1 × 210

Step 3 : Single precision representation

For a given number S = 0, E = 10 and M = 0 0 1 1 1 0 1 0 1 1 0 0 1

Bias for single precision format is = 127

E' = E + 127 = 10 + 127 = 13710

    = 1 0 0 0 1 0 0 12

Number in single precision format is given as


Step 4 : Double precision representation

For a given number

S = 0, E = 10, and M = 0 0 1 1 1  0 1 0 1 1 0 0 1

Bias for double precision format is = 1023

E' = E + 1023= 10 + 1023 = 103310 = 1 0 0 0 0 0 0 1 0 0 12

Number in double precision format is given as


Example: 2

Represent – 307.187510 in single precision and double precision formats.

Solution :

Step 1: Convert decimal number in binary format integer part


Integer part, Fractional part :


(0.1875)10 = (0.0011)2

Binary number = – 100110011 + .0011

                        = – 100110011. 0011

Step 2 : Normalize the number

– 1 0 0 1 1 0 1 1 . 0 0 1 1 =  – 1. 0 0 1 1 0 0 1 1 0 0 1 1 × 28

Step 3 : Single precision representation

For a given number

S = 1, E = 8,         and M = 0011 0011 0011

Bias for single precision format is = 127

E' = E+ 127 8+ 127 13510 = 100001112

Number in single precision format is given as


Step 4 : Double precision representation

For a given number

S = 1,   E = 8  and       M = 0011 0011 0011

Bias for double precision format is = 1023

E' = E + 1023 = 8 + 1023 = 103110 = 100000001112

Number in double precision format is given as


Example: 3

Show the IEEE 754 binary representation of the number (–0.75)10 in single precision.

Solution :

Step 1: Convert decimal number in binary format.


– (0.75)10 = – (0.11)2

Step 2 : Normalize the number.

– 0.11 = –1.1x2–1

Step 3 : Single Precision Representation

For a given number S = 1, E = – 1 and M = 1

Bias for single precision format is = 127

E' = E + 127 = (–1) + 127 =12610 = (01111110)2

Number in single precision format is given as,


Examples for Practice

Example: 4

Represent (309.1875)10 in single precision and double precision format.

 Answer:


Example: 5

Represent (0.0625)10 in single precision and double precision formats.

 Answer:


Example: 6

Represent 32.75 and 18.125 in single precision IEEE 754 representation.

 Answer:


 

Review Questions

1. What are floating pointer numbers ?

2. Explain the representations of floating point numbers in detail.

3. Draw the format of floating point number.

4. Define IEEE floating point single and double precision standard.

 

2. Special Values

• The extreme values of biased exponent, E' are used to represent special values. When E' = 0 and the mantissa fraction M is zero, the value exact 0 is represented. The biased exponent with all 1s is reversed to represent infinity, where infinity is the result of dividing a normal number by zero. The sign bit is still part of these representations, so there are ± 0 and ± ∞ representations.

• When E' = 0 and M ≠ 0, denormal numbers are represented. A denormal is a result that causes an underflow and has leading 0s in the mantissa even after the exponent is adjusted to its smallest possible value. The E' with all 1s and M ≠ 0 is reserved to represent Not a Number (NaN). A NaN is the result of performing an invalid operation such as 0/0 or  √–1.

 

Review Questions

1. What is denormal ? Define NaN ?

 

3. Exceptions

• According to IEEE standards, the processor sets exception flags if underflow, overflow, divide by zero, inexact or invalid conditions occur during the program execution.

Underflow : In a single precision, if the number requires an exponent less than – 126 or in a double precision, if the number requires an exponent less than –1022 to represent its normalized form the underflow occurs.

Overflow : In a single precision, if the number requires an exponent greater than + 127 or in a double precision, if the number requires an exponent greater than + 1023 to represent its normalized form the overflow occurs.

Divide by zero : Divide by zero exception occurs when any number is divided by zero.

Inexact : Inexact is the name for a result that requires rounding in order to be represented in one of the normal formats.

Invalid : An invalid exception occurs if operations such as 0/0 or √1 are attempted. When exception occurs, the results are set to special values. System and user defined routines are used to handle such exceptions.

 

Review Questions

1. In conforming to the IEEE standard mention any four situations under which a processor sets exception flag.

2. Define underflow and overflow.


Digital Principles and Computer Organization: Chapter 4: Combinational Circuits : Tag: : - Floating Point Numbers


Digital Principles and Computer Organization: Chapter 4: Combinational Circuits



Under Subject


Digital Principles and Computer Organization

CS25C06 2nd Semester AIDS, CSE, IT, CSE(CY) Dept | 2025 Regulation | 2nd Semester 2025 Regulation



Related Subjects


English Essentials II

EN25C02 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation



Linear Algebra

MA25C02 2nd Semester | 2025 Regulation


Applied Physics (CSIE) II

PH25C03 2nd Semester AIDS, CSE, IT, CSE(CY) Dept | 2025 Regulation | 2nd Semester 2025 Regulation


Digital Principles and Computer Organization

CS25C06 2nd Semester AIDS, CSE, IT, CSE(CY) Dept | 2025 Regulation | 2nd Semester 2025 Regulation


Basic Electrical and Electronics Engineering

EE25C01 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation


Python for Data Science

AD25201 2nd Semester AIDS Dept | 2025 Regulation | 2nd Semester 2025 Regulation


Re-Engineering for Innovation

ME25C05 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation


Python for Data Science - Laboratory

AD25201 2nd Semester AIDS Dept | 2025 Regulation | 2nd Semester 2025 Regulation