Floating Precision Problem

Revision en2, by alpercakan, 2015-08-13 00:46:40

For the problem UVa-579 I get AC if I use ((h*60)*0.5)+(m*0.5)-(m*6) for calculation, but if I use (h*30+m/2)-(m*6) I get WA. I know that it's something about precision problem (like comparison), but answer is printed with 3 digits after decimal point; so I didn't think this kind of change in calculation would be a problem. I don't know what's the best way for this kind of calculations. How should I calculate?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English alpercakan 2015-08-13 00:46:40 135
en1 English alpercakan 2015-08-13 00:40:28 425 Initial revision (published)