while storing the value 1.111 in a float variable the value stored and printed is 1.1109999.
why is this loss of data or sometimes the gain of data?.

Recommended Answers

All 2 Replies

This article explains it all.

commented: An article everyone should read +13

you can also regulate your output decimal place....
%3f... should give you 1.111 instead of 1.11099999.....
hope I help, I am also a learner

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.