- 论坛徽章:
- 145
|
$ echo "0.56" | awk '{printf "%d\n",$1*100}' # 打印正确56
$ echo "0.57" | awk '{printf "%d\n",$1 ...
qinghan1125 发表于 2010-11-23 16:59 ![]()
# echo "0.55" | awk '{printf "%2.20f\n",$1*100}'
55.00000000000000710543
# echo "0.56" | awk '{printf "%2.20f\n",$1*100}'
56.00000000000000710543
# echo "0.57" | awk '{printf "%2.20f\n",$1*100}'
56.99999999999999289457
# echo "0.58" | awk '{printf "%2.20f\n",$1*100}'
57.99999999999999289457
# echo "0.59" | awk '{printf "%2.20f\n",$1*100}'
59.00000000000000000000
# echo "0.56" | awk '{printf "%2.0f\n",$1*100}'
56
# echo "0.57" | awk '{printf "%2.0f\n",$1*100}'
57
# echo "0.58" | awk '{printf "%2.0f\n",$1*100}'
58 |
|