Thanks, but no, that is not what i am looking for.
Imagine you are doing many divisions, that produce numbers with decimals.(say distributing costs over 5 departments)
But you don't want decimals on your report (or in your accounting system for that matter).
int() will cut off the decimals, but if you are allocating costs, you will come up short at the end of the day.
(you lost all of the cents)
if you do int( x + 0.50) , this will produce a floor() or a ceil() depending on the value of the decimal.
"random" so to speak.
So i am wondering if python offers a function that will do this without adding the 0.50.
It could be that this age old trick is still necessary.
EDIT : if you think this is a strange question: why then did they invent "ceil()" ? Adding 1 instead of 0.50 does that trick also. :-)
Paul
Imagine you are doing many divisions, that produce numbers with decimals.(say distributing costs over 5 departments)
But you don't want decimals on your report (or in your accounting system for that matter).
int() will cut off the decimals, but if you are allocating costs, you will come up short at the end of the day.
(you lost all of the cents)
if you do int( x + 0.50) , this will produce a floor() or a ceil() depending on the value of the decimal.
"random" so to speak.
So i am wondering if python offers a function that will do this without adding the 0.50.
It could be that this age old trick is still necessary.
EDIT : if you think this is a strange question: why then did they invent "ceil()" ? Adding 1 instead of 0.50 does that trick also. :-)
Paul