MASON CS 365 - Floating Point Arithmetic

Unformatted text preview:

1CS365 1Floating Point ArithmeticCS 365 Lecture 8Prof. Yih HuangCS365 2Scientific Notation6.02 x 10 23exponentradix (base)Mantissadecimal pointSign, magnitudeSign, magnitude2CS365 3Floating Point Numbers  We need a way to represent– numbers with fractions, e.g., 3.1416– very small numbers, e.g., .000000001– very large numbers, e.g., 3.15576 × 109 Representation:– sign, exponent, significand: (–1)sign×××× significand ×××× 2exponent– more bits for significand gives more accuracy– more bits for exponent increases rangeCS365 4Issues Arithmetic (+, -, ×, /) Representation, Normal form Range and Precision Rounding Exceptions (e.g., divide by zero, overflow, underflow) Errors3CS365 5IEEE 754 Standards single precision: 8 bit exponent, 23 bit significand double precision: 11 bit exponent, 52 bit significandCS365 6IEEE 754 Single Precision Exponent: biased 127 binary integer– Real exponent e = E − 127 Mantissa: Signed magnitude, normalized significant with a hidden 1. Value:S E (Exponent) M (Magnitude)1 8 bits23 bits1272).1()1(−××−ESM4CS365 7DiscussionsLeading “1” bit of significand is implicitExponent is “biased”–bias of 127 –all 0s is smallest exponent; all 1s is largest Magnitude of numbers that can be represented: 2-126to 2127(2−2-23) Or in decimal numbers: 1.8×10-38to 3.4×1038CS365 8Exercise Give the single precision representation of 1.0.  Give the single precision representation of -0.875  Give the single precision representation of 0.15CS365 9Exercise Calculate the value of 0 1 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0CS365 10Floating Point Arithmetic1.12+ 0.0000012 Step 1: alignment of decimal point Step 2: add significands Step 3: normalization6CS365 110 10 1 0 1ControlSmall ALUBig ALUSign Exponent Significand Sign Exponent SignificandExponentdifferenceShift rightShift left or rightRounding hardwareSign Exponent SignificandIncrement ordecrement0 10 1Floating Point


View Full Document

MASON CS 365 - Floating Point Arithmetic

Download Floating Point Arithmetic
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Floating Point Arithmetic and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Floating Point Arithmetic 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?