# round.awk --- do normal rounding # # 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 } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
assert.awk | File | 382 B | 0644 |
|
bits2str.awk | File | 327 B | 0644 |
|
cliff_rand.awk | File | 307 B | 0644 |
|
ctime.awk | File | 233 B | 0644 |
|
ftrans.awk | File | 317 B | 0644 |
|
getopt.awk | File | 2.18 KB | 0644 |
|
gettime.awk | File | 2.43 KB | 0644 |
|
group.awk | File | 1.75 KB | 0644 |
|
join.awk | File | 378 B | 0644 |
|
libintl.awk | File | 238 B | 0644 |
|
noassign.awk | File | 425 B | 0644 |
|
ord.awk | File | 937 B | 0644 |
|
passwd.awk | File | 1.17 KB | 0644 |
|
quicksort.awk | File | 1023 B | 0644 |
|
readable.awk | File | 492 B | 0644 |
|
rewind.awk | File | 404 B | 0644 |
|
round.awk | File | 661 B | 0644 |
|
strtonum.awk | File | 1.43 KB | 0644 |
|
walkarray.awk | File | 214 B | 0644 |
|
zerofile.awk | File | 424 B | 0644 |
|