This preview shows page 1. Sign up to view the full content.
Unformatted text preview: n is actually equivalent
to about 7.2 decimal digits).
Prior to any arithm etic operation, convert all operands to the leading seven digits –
r ounding if necessary.
(The leading digit is the leftm ost non - zer o – w here it occurs has nothing to do with a decim al
1. 123.456789 converts to 123.4568 (notice the rounding)
2. 123456789000 converts to 123456800000.
3 . 00000000123456749 converts to .000000001234567.
T o sim ulate a single floating poi nt com putation do this:
a. D o the operation exactly .
b. T ake this result, leave the decimal point w here it is, but truncate (or round) all digits
follow ing the leading 7.
1. 123.4567 + 9.876543 = 133.333243 (exactly ) and this is truncated to 133.3332 (same w ith
2. 123.4567 - 9.876543 = 113.580157 (exactly) and this is truncated to 113.5801 or rounded to
3. 123.4567 * 9.876543 = 1219.3254061881 (exactly) and this is truncated to 1219.325 (same
w ith rounding) 4. 123.4567 / 9.876543 = 12.499991140624811.....
View Full Document
This note was uploaded on 03/21/2014 for the course M 340L taught by Professor Pavlovic during the Spring '08 term at University of Texas.
- Spring '08