(Solved) : Consider Following Java Program Public Class Flot Public Static Void Main String Args Doub Q31819492 . . .
Consider the following Java program:
public class Flot {
public static void main(String args[]) {
double a = 0.1;
double x = 0.0;
double error;
int i;
for (i=1; i<=10; i++) x = x + a;
error = x – 1.0;
System.out.println(“x = ” + x + “, error = ” + error);
}
}
The output from the above program is:
x = 0.9999999999999999, error = -1.1102230246251565E-16
Why is the value of x not equal to one?
Expert Answer
Answer to Consider Following Java Program Public Class Flot Public Static Void Main String Args Doub Q31819492 . . .
OR