Consider the expression fx squareroot 1 x2 squareroot 1
Consider the expression f(x) = squareroot 1 - x^2 - squareroot 1 + x^2. Rearrange f(x) in a manner so that it will be computed accurately for small x. Give a good approximate value for f(10^-7). At about what value of x will your algorithm produce f(x) = 0 due to underflow in single precision IEEE arithmetic?
Solution
the good approximte value for the function where x = 10-7 is zero.
if we substitute x = 0, we get 1-1 =0;
at what value of x, we consider x2 as zero the given function will be zero for that value of x
of we consider x= 0.1 , x^2 becomes 0.01 where we cant consider the value as zero
based on the approximations to 3, 5 ,7 decimal places we consider value as zero
approx. 7 decimal digits
based on IEEE single precision the value of X should be 10-4
| level | width | range at full precision | precision* |
|---|---|---|---|
| single precision | 32 bits | ±1.18×1038 to ±3.4×1038 | approx. 7 decimal digits |
