cs3330-chap3-arith-2

cs3330-chap3-arith-2 - 1 CS/ECE 3330 CS/ECE 3330 Computer...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: 1 CS/ECE 3330 CS/ECE 3330 Computer Architecture Chapter 3 Floating Point Operations on integers Addition and subtraction Multiplication and division Last Time Dealing with overflow CS/ECE 3330 Fall 2009 23 2 Representation for non-integral numbers Including very small and very large numbers Like scientific notation Floating Point 2.34 10 56 +0.002 10 4 +987.02 10 9 In binary 1.xxxxxxx 2 2 yyyy normalized not normalized CS/ECE 3330 Fall 2009 2 Types float and double in C 24 Defined by IEEE Std 754 - 1985 Developed in response to divergence of representations Floating Point Standard Portability issues for scientific code Now almost universally adopted Two representations Single precision (32-bit) Double precision (64-bit) CS/ECE 3330 Fall 2009 25 3 IEEE Floating-Point Format S Exponent Fraction single: 8 bits double: 11 bits single: 23 bits double: 52 bits S: sign bit (0 non-negative, 1 negative) Normalize significand: 1.0 |significand| < 2.0 Always has a leading pre-binary-point 1 bit, so no need to represent it explicitly (hidden bit) Bias) (Exponent S 2 Fraction) (1 1) ( x + = CS/ECE 3330 Fall 2009 Significand is Fraction with the 1. restored Exponent: excess representation: actual exponent + Bias Ensures exponent is unsigned Single: Bias = 127; Double: Bias = 1023 26 Exponents 00000000 and 11111111 reserved Smallest value Exponent: 00000001 Single-Precision Range actual exponent = ______________ Fraction: 00000 significand = ____ 1.0 2 126 1.2 10 38 Largest value exponent: 11111110 1 - 127 = -126 1.0 CS/ECE 3330 Fall 2009 actual exponent = ________________ Fraction: 11111 significand ____ 2.0 2 +127 3.4 10 +38 27 254 127 = +127 2.0 4 Exponents 000000 and 111111 reserved Smallest value Exponent: 00000000001 Double-Precision Range actual exponent = ______________ Fraction: 00000 significand = ____ 1.0 2 1022 2.2 10 308 Largest value Exponent: 11111111110 1 1023 = -1022 1.0 CS/ECE 3330 Fall 2009 actual exponent = ___________________ Fraction: 11111 significand ____ 2.0 2 +1023 1.8 10 +308 28 2046 1023 = +1023 2.0 Relative precision all fraction bits are significant Single: approx 2 23 Floating-Point Precision Equivalent to 23 log 10 2 23 0.3 6 decimal digits of precision Double: approx 2 52 Equivalent to 52 log 10 2 52 0.3 16 decimal digits of precision CS/ECE 3330 Fall 2009 29 5 Represent 0.75 0.75 = (1) 1 1.1 2 2 1 S = 1 Floating-Point Example...
View Full Document

Page1 / 15

cs3330-chap3-arith-2 - 1 CS/ECE 3330 CS/ECE 3330 Computer...

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

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