usr/lib/byobu/.shutil: fix rounding error in fpdiv

Previously:
    $ fpdiv 119 100 1
    1.1
  Now:
    $ fpdiv 119 100 1
    1.2
This commit is contained in:
Scott Moser 2011-10-21 13:33:21 -04:00
commit f833b191ed
2 changed files with 5 additions and 2 deletions

5
debian/changelog vendored
View file

@ -16,7 +16,10 @@ byobu (4.42) unreleased; urgency=low
* usr/lib/byobu/.constants, usr/lib/byobu/network: * usr/lib/byobu/.constants, usr/lib/byobu/network:
- save a few more chars, drop the "ps" per second - save a few more chars, drop the "ps" per second
-- Dustin Kirkland <kirkland@ubuntu.com> Fri, 14 Oct 2011 14:53:51 -0500 [Scott Moser]
* usr/lib/byobu/.shutil: fix rounding error in fpdiv
-- Scott Moser <smoser@brickies> Fri, 21 Oct 2011 13:31:59 -0400
byobu (4.41-0ubuntu1) precise; urgency=low byobu (4.41-0ubuntu1) precise; urgency=low

View file

@ -174,7 +174,7 @@ fpdiv() {
n=$(((${mp}*${a})/${b})) n=$(((${mp}*${a})/${b}))
# round up if necessary # round up if necessary
[ $(($n%${mp})) -ge $((${mp}/2)) ] && n=$(($n+5)) [ $((($n-5)/10)) = $(($n/10)) ] && n=$(($n+5))
# drop the last digit, which was only there for rounding # drop the last digit, which was only there for rounding
n=${n%?} n=${n%?}