function ceiling(x)
{
return (x == int(x)) ? x : int(x)+1
}
Stolen from link
Monday, November 3, 2008
Rounding in awk
echo $1 | awk '
function round(aa) {
return int( aa + 0.5 )
}
{
printf("%d\n",round($1));
}'
Stolen from link
function round(aa) {
return int( aa + 0.5 )
}
{
printf("%d\n",round($1));
}'
Stolen from link
Subscribe to:
Posts (Atom)