FP_Representation

FP_Representation - CoE - ECE 0142 Computer Organization...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Lecture 3 Floating Point Representations CoE - ECE 0142 Computer Organization
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Floating-point arithmetic ± We often incur floating-point programming. Floating point greatly simplifies working with large (e.g., 2 70 ) and small (e.g., 2 -17 ) numbers ± We’ll focus on the IEEE 754 standard for floating-point arithmetic. How FP numbers are represented Limitations of FP numbers FP addition and multiplication
Background image of page 2
3 Floating-point representation ± IEEE numbers are stored using a kind of scientific notation. ± mantissa * 2 exponent ± We can represent floating-point numbers with three binary fields: a sign bit s , an exponent field e , and a fraction field f . ± The IEEE 754 standard defines several different precisions. Single precision numbers include an 8-bit exponent field and a 23-bit fraction, for a total of 32 bits. Double precision numbers have an 11-bit exponent field and a 52-bit fraction, for a total of 64 bits. se f
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Sign ± The sign bit is 0 for positive numbers and 1 for negative numbers. ± But unlike integers, IEEE values are stored in signed magnitude format. s ef
Background image of page 4
5 Mantissa ± There are many ways to write a number in scientific notation, but there is always a unique normalized representation, with exactly one non-zero digit to the left of the point. 0.232 × 10 3 = 23.2 × 10 1 = 2.32 * 10 2 = … 01001 = 1.001× 2 3 = … ± The field f contains a binary fraction. ± The actual mantissa of the floating-point value is (1 + f) . In other words, there is an implicit 1 to the left of the binary point. For example, if f is 01101… , the mantissa would be 1.01101… ± A side effect is that we get a little more precision: there are 24 bits in the mantissa, but we only need to store 23 of them. ± But, what about value 0? se f
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Exponent ± There are special cases that require encodings Infinities (overflow) NAN (divide by zero) ± For example: Single-precision: 8 bits in e 256 codes; 11111111 reserved for special cases 255 codes; one code for zero 254 codes; need both positive and negative exponents half positives (127), and half negatives (127) Double-precision: 11 bits in e 2048 codes; 111…1 reserved for special cases 2047 codes; one code for zero 2046 codes; need both positive and negative exponents half positives (1023), and half negatives (1023) s e f
Background image of page 6
7 Exponent ± The e field represents the exponent as a biased number.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 25

FP_Representation - CoE - ECE 0142 Computer Organization...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online