Question: Alex writes a simple program to calculate the final cost of a purchase: cost 0 . 7 tax 0 . 1 final cost + tax

Alex writes a simple program to calculate the final cost of a purchase:
cost 0.7
tax 0.1
final cost + tax
They're surprised to see that final stores the value 0.7999999999999999 instead of 0.8.
What is the best explanation for that result?
Choose 1 answer:
Choose 1 answer:
(Choice A) An integer overflow error occurred.
A
An integer overflow error occurred.
(Choice B) The result was too large of a number to be stored in floating-point representation.
B
The result was too large of a number to be stored in floating-point representation.
(Choice C) The arithmetic operations on floating-point numbers resulted in a round-off error.
C
The arithmetic operations on floating-point numbers resulted in a round-off error.
(Choice D) The computer stored the result with floating-point representation instead of integer representation.
D
The computer stored the result with floating-point representation instead of integer representation.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!