Question: When floating point numbers (i.e. float) are added in C round off errors can occur if the numbers differ by more than 7 significant digits.
When floating point numbers (i.e. float) are added in C round off errors can occur if the numbers differ by more than 7 significant digits. For example, if a = 100,000,000 and b = 1 then c = a + b will differ from its exact value. Write a program roundoff.c to illustrate this. Your program should prompt the user for two numbers and then compute and print the sum and should look like:
Enter a number: 100000000
Enter another number which is significantly smaller: 1
The sum of 100000000.000000 and 1.000000 is 100000000.000000
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
