8. (Machine Epsilon) Machine epsilon gives an upper bound on the relative error due to rounding in...
Question:
8. (Machine Epsilon)
Machine epsilon gives an upper bound on the relative error due to rounding in floatingpoint arithmetic. In C++11, epsilon is the difference between 1.0 and the next representable value of the given floating-point type.
Answer the following questions:
a) Write a small C function to compute epsilon:
double epsilon = 1.0;
while ((1.0 + 0.5*epsilon) != 1.0)
{
epsilon *= 0.5;
}
Generalise this function for other types.
b) Compare the value from part
a) with the value produced by:
std::numeric_limits
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Question Posted: