Menu

(Solved) : Given Value S Approximation S Absolute Error S S Relative Error S S S Run Round Error Pr Q31311349 . . .

Given a value S and an approximation S’ to it, theabsolute error is | S-S’ |.
The relative error is | (S-S’)/S |.

Run the “round-off error” program

x = 1.0/n

for k = 1 to M do {

    x = x*(n+1.0) – 1.0

}

print, n, M, x

Run the program in both single precision (float) and in doubleprecision (double). As in the previous question, it may benecessary to create a variable one. The final value of xshould be 1/n. Note that n is stored as a floating point number.Make a table with rows indexed by n=5,6,7,8,9,10, and columns:initial x, final x, absolute error, relative error. Do this forM=10, 20, 30, in both single and double precision. (You should have6 tables to hand in.) Print x with 7 digits in single precision,and 15 digits in double precision.

Expert Answer


Answer to Given Value S Approximation S Absolute Error S S Relative Error S S S Run Round Error Pr Q31311349 . . .

OR