Your program is nt behaving as wat u expect where sometimes it output the correct and at times incorrect result. During debugging,u manage to locate the problem to the following statement.
A/b == c
Where a,b,c are using the ieee 754 floating point representation and where the value c is generate in an earlier arithmetic statement in the program. The statement return a false although u expect the left hand side to ne similar to the right side. Why this problem occurs n how to solve it
angelineang
0
Newbie Poster
Recommended Answers
Jump to PostRead this http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html and look at the section Rounding Error.
Play around with this#include <iostream> #include <iomanip> #include <cmath> // Might need this later #include <cfloat> using namespace …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.