|
What I want to do is have a timer on top of the screen counting how long you have been alive. The code for it is simple, and it works:
The problem is, it shows 7 places after the decimal. I want it to show just one so it looks like this: 70.7. I do not want it the other way as it is VERY distracting and no need for it to be so precise. I would like to know how to do this as it will help keep track of scores and what not.
(comments are locked)
|
|
Use this: Works perfectly! Thank you for that one...and as usual with one problem solved, a dozen more come up!
May 16 '10 at 11:55 PM
xToxicInferno
I've been looking for that too for a couple of hours! - thanks a bunch Eric5h5!
Dec 07 '10 at 06:54 PM
schwertfisch
sorry to ask a question here, but does f2 mean 2 decimal places, and f3 mean 3 decimal places and so on?
Dec 23 '10 at 05:46 PM
Jesus_Freak
Give it a try and see.
Dec 23 '10 at 07:06 PM
Eric5h5
I really needed this too! Thanks so much.
Jan 08 '12 at 12:20 AM
Pixelen
(comments are locked)
|
|
I think this question was asked a while ago (though QATO doesn't seem to give the year with the date), but in case anyone comes across it: To round floats to arbitrarily decimal places without converting to strings (as in Eric5h5's solution), you can use (as a general solution): If you specifically only ever want one decimal place: Or two: And so on... (As an aside, you can also use this kind of technique to round to the nearest anything: e.g. to round to nearest interval of 0.3 by using I found this to be equally as useful as Eric's suggestion, thank you!, Lauren.
May 23 '12 at 02:29 PM
MithosAnnar
(comments are locked)
|
