0% found this document useful (0 votes)
167 views6 pages

1.2 Round - Off Error and Computer Arithmetic: Floating Point Numbers

This document discusses sources of error in computer arithmetic and scientific computations. It provides examples of how real numbers are approximated using floating point representations with a limited number of digits, which can introduce rounding or chopping errors. Absolute and relative errors are defined and calculated for examples. Specific sources of error discussed include subtracting nearly equal numbers and computing polynomials and series using limited precision arithmetic.

Uploaded by

Aqe Kitam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
167 views6 pages

1.2 Round - Off Error and Computer Arithmetic: Floating Point Numbers

This document discusses sources of error in computer arithmetic and scientific computations. It provides examples of how real numbers are approximated using floating point representations with a limited number of digits, which can introduce rounding or chopping errors. Absolute and relative errors are defined and calculated for examples. Specific sources of error discussed include subtracting nearly equal numbers and computing polynomials and series using limited precision arithmetic.

Uploaded by

Aqe Kitam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Chapter 1

1.2 Round –Off Error and Computer arithmetic

Floating point numbers


Machine numbers are represented in k-digit normalized
form:

±𝟎. 𝒅𝟏 𝒅𝟐 … 𝒅𝒌 𝜷𝒏 , 𝒅𝟏 ≠ 𝟎 , 𝟎 ≤ 𝒅𝒊 < 𝛽
Mantissa Base Exponent

Approximated numbers
Real numbers are approximated by chopping or
rounding.

Example 1
Approximate the number 𝒑 = 𝟒𝟑. 𝟓𝟔𝟒𝟑𝟖𝟓𝟒, using:
a) 3-digit chopping: 𝑓𝑙(𝑝) = 43.5 = 0.435 ∗ 102
b) 3 digit rounding: 𝑓𝑙 (𝑝) = 43.6 = 0.436 ∗ 102

Example 2
Approximate the number 𝒑 = 𝟓𝟐, 𝟓𝟔𝟒, 𝟑𝟖𝟓, using:
c) 3-digit chopping: 𝑓𝑙(𝑝) = 52,500,000 = 0.525 ∗ 108
d) 3 digit rounding
e) 2 digit chopping
f) 2-digit rounding

1
Error Measuring
Let 𝒑∗ be an approximation to a real number 𝒑. Then
𝒆𝒑 = |𝒑∗ − 𝒑| is called absolute error
|𝒑∗ −𝒑| |𝒑∗ −𝒑|
𝜹𝒑 = |𝒑|
~ | 𝒑∗ | is called relative error

Example 3
Find the absolute error and the relative error:
a) 𝒑∗ = 𝟎. 𝟐 ∗ 𝟏𝟎𝟐 ~𝒑 = 𝟐𝟏

b) 𝒑∗ = 𝟎. 𝟐 ∗ 𝟏𝟎𝟓 ~𝒑 = 𝟐𝟏𝟎𝟎𝟎

c) 𝒑∗ = 𝟎. 𝟐 ∗ 𝟏𝟎−𝟑 ~𝒑 = 𝟎. 𝟎𝟎𝟎𝟐𝟏

Remark
Using absolute error or relative error may be misleading

2
Example 4 Let
𝟒 𝟐
𝒑= +
𝟕 𝟑
Calculate:
a) Exact value of 𝒑.

b) Approximate value of 𝒑 , using 3-digit chopping


arithmetic.
𝟒 𝟏
𝒇𝒍(𝒑) = 𝒇𝒍 �𝒇𝒍 � � + 𝒇𝒍 � �� =
𝟕 𝟑

c) Approximate value of 𝒑 , using 3-digit rounding


arithmetic.

d) Compute the relative errors in parts b and c.

3
Errors in Scientific Computations

Subtracting of nearly equal numbers


Example 1
1
Consider 𝑝 = √626 − √625 and 𝑞 = .
√626+√625
a) Approximate 𝑝 and 𝑞 , using 4-digig chopping
arithmetic.
b) Calculate the relative errors in part (a)

√626 = 25.019992 … , √625 = 25.00


𝑝 = √626 − √625 = 0.019992 …
𝑝∗ = 𝑓𝑙[𝑓𝑙(√626) − 𝑓𝑙(�625)]

= 𝑓𝑙(25.01 − 25.00) = 0.01

|𝑝−𝑝∗ | 0.009992… 0.01


𝛿𝑝 = |𝑝|
= ≈ = 50%
0.019992… 0.02

4
Polynomial computation

To evaluate 𝑷𝟒 (𝑥 ) = 𝑎4 𝑥 4 + 𝑎3 𝑥 3 + 𝑎2 𝑥 2 + 𝑎1 𝑥 + 𝑎0 at = 𝛼
, the number of operations is reduced when a nested form is
used:
𝑷𝟒 (𝑥 ) = 𝑥(𝑥(𝑥(𝑎4 𝑥 + 𝑎3 ) + 𝑎2 ) + 𝑎1 ) + 𝑎0

Example 2
Consider. 𝒇(𝑥 ) = 𝑥 3 − 6.1𝑥 2 + 3.2𝑥 + 1.5,
𝒈(𝑥 ) = 𝑥(𝑥(𝑥 − 6.1) + 3.2) + 1.5

Compute 𝒇(4.71) and (4.71) , using


a) Exact values

>

>

>

b) 3-digit rounding
>

5
Computation of Series
Starting with sum of small numbers will reduces the error

Example 3
Use 3-digit chopping arithmetic to compute:
1
a) ∑10
1 𝑛2
= 1.53

1
b) ∑10
1 (11−𝑛)2

= 1.54
Actual value of the sum is 1.541

You might also like