Write a program that demonstrates the approximate nature of floating point values by performing the following tasks:
Question:
Write a program that demonstrates the approximate nature of floating point values by performing the following tasks:
- Use Scanner to read a floating-point value x.
- Compute 1.0 / x and store the result in y.
- Display x, y, and the product of x and y.
- Subtract 1 from the product of x and y and display the result.
Try your program with values of x that range from 2e-11 to 2e11. What can you conclude?
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Question Posted: