K2LL33D SHELL

 Apache/2.4.7 (Ubuntu)
 Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64
 uid=33(www-data) gid=33(www-data) groups=33(www-data)
 safemode : OFF
 MySQL: ON | Perl: ON | cURL: OFF | WGet: ON
  >  / usr / share / awk /
server ip : 104.21.89.46

your ip : 172.70.130.226

H O M E


Filename/usr/share/awk/round.awk
Size661
Permissionrw-r--r--
Ownerroot : root
Create time27-Apr-2025 09:55
Last modified03-Jul-2013 04:42
Last accessed05-Jul-2025 20:45
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
# round.awk --- do normal rounding
#
# Arnold Robbins, [email protected], 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
}
}