I used Dev c++, and version is 18.104.22.168.
I write coding for rounding, and I confuse something.
Please watch my coding in below:
If I input a=4.15, the output is 4.2
If I input a=4.25, the output is 4.3
If I input a=4.35, the output is still 4.3, but it should be 4.4
Can anyone give me suggestions about this? Thanks.
(int)((a+0.05)*10)/10.0 should work better.. I think
Although 0.5 is a simple number in decimal, it's not in binary
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.