Rounding a number to nearest even

andrewdied at gmail.com andrewdied at gmail.com
Mon Apr 14 17:01:28 CEST 2008


On Apr 11, 4:14 am, bdsatish <bdsat... at gmail.com> wrote:

> I'm interested in rounding numbers of the form "x.5" depending upon
> whether x is odd or even. Any idea about how to implement it ?

Side note: A specialized use for this is in the US Field Artillery,
where it's called "artillery expression."  You don't round, but
"express" a fraction to the nearest even whole number.  2.5 is 2.0,
3.5 is 4.0, etc.  Or, if you need to express to the tens, 15 is 20, 25
is 20, and so on.



More information about the Python-list mailing list