Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > Re: rounding up...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 7 Topic 2104 of 2378
Post > Topic >>

Re: rounding up (or down) issue

by Bill Marcum <marcumbill@[EMAIL PROTECTED] > Dec 19, 2007 at 02:34 PM

["Followup-To:" header set to comp.unix.shell.]
On 2007-12-19, Farid Hamjavar <hamjavar@[EMAIL PROTECTED]
> wrote:
>
>
>
> Greetings,
>
> I have data lines in  a file like these whose
> components add up to 100:
>
> 1.73   0.45   98.72
> 1.88   23.11  75.01
> 16.88  0.88   82.24
>
>
>
> Yet, when attempting to round down (or up)
> resulting data will not be 100 in total:
>
> e.g. 2nd row , rounded up:
> 2   24   75    = 101
>
> e.g. 2nd row , rounded down:
> 1   23   75    = 99
>
>
> I need to round them up (or down) for re****ting
> purpose in which the line show up like:
>
> 2%     24%    75%   = 101%
>
>
>
> How does one get round this?
> i.e. Any way to get 100 after rounding up (or down)?
>
Round the sums after you add them, not before.
 




 7 Posts in Topic:
rounding up (or down) issue
Farid Hamjavar <hamjav  2007-12-19 09:32:09 
Re: rounding up (or down) issue
Janis Papanagnou <Jani  2007-12-19 18:04:02 
Re: rounding up (or down) issue
Grant <g_r_a_n_t_@[EMA  2007-12-20 06:52:38 
Re: rounding up (or down) issue
Ed Morton <morton@[EMA  2007-12-19 23:43:59 
Re: rounding up (or down) issue
Bill Marcum <marcumbil  2007-12-19 14:34:46 
Re: rounding up (or down) issue
Ed Morton <morton@[EMA  2007-12-19 23:40:14 
Re: rounding up (or down) issue
Ed Morton <morton@[EMA  2007-12-19 23:53:33 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 11:18:22 CDT 2008.