2015/06/25

Divide with floating point

awk 'BEGIN {printf "%.2f \n", (11.226 - 8.342)/11.226*100}'
awk 'BEGIN {print (11.226-8.342)/11.226*100}'

Rounding up works by default:
awk 'BEGIN {printf "%.3f \n", (11.226 - 8.342)/11.226*100}'

No comments:

Post a Comment