main()
{
float a=0.7;
if(a<0.7) cout<<"true" ;else cout<<"false";
}
problem---> it prints true .....
when 0.7 is replaced everywhere with 0.8 it displays false
again with 0.9 , it displays true..
typically only for 0.7 and 0.9 it gives different answer ,then the conventional logical answer..why so??
npd_ddit
0
Newbie Poster
Recommended Answers
Jump to PostThis thread here talks about float comparisons. There's a good link available in the thread about the same.
All 3 Replies
mrinal.s2008
0
Light Poster
Agni
370
Practically a Master Poster
Featured Poster
npd_ddit
0
Newbie Poster
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.