Added Cyg-Win
This commit is contained in:
parent
82cbc206eb
commit
413c315806
10586 changed files with 3806249 additions and 0 deletions
33
Agent-Windows/OGP64/usr/share/awk/round.awk
Normal file
33
Agent-Windows/OGP64/usr/share/awk/round.awk
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# round.awk --- do normal rounding
|
||||
#
|
||||
# This file and how to use it are described in the manual.
|
||||
# Therefore, we respectfully advise you to Read The Fine Manual
|
||||
# for more information.
|
||||
#
|
||||
# Arnold Robbins, arnold@skeeve.com, Public Domain
|
||||
# August, 1996
|
||||
|
||||
function round(x, ival, aval, fraction)
|
||||
{
|
||||
ival = int(x) # integer part, int() truncates
|
||||
|
||||
# see if fractional part
|
||||
if (ival == x) # no fraction
|
||||
return ival # ensure no decimals
|
||||
|
||||
if (x < 0) {
|
||||
aval = -x # absolute value
|
||||
ival = int(aval)
|
||||
fraction = aval - ival
|
||||
if (fraction >= .5)
|
||||
return int(x) - 1 # -2.5 --> -3
|
||||
else
|
||||
return int(x) # -2.3 --> -2
|
||||
} else {
|
||||
fraction = x - ival
|
||||
if (fraction >= .5)
|
||||
return ival + 1
|
||||
else
|
||||
return ival
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue