- 論壇徽章:
- 0
|
關(guān)于累加的疑問(wèn)
對(duì)乘除比較煩,還要明確指定scale
原帖由 "bjgirl" 發(fā)表:
shell不能處理浮點(diǎn)數(shù)@_@,不過(guò)解決方法很多如:
echo "1.1+1.2"|bc
2.3
- [root@m7 Linux]# bc
- 4.0/3.0
- 1
- scale=4
- 4.0/3.0
- 1.3333
復(fù)制代碼The most basic element in bc is the number. Numbers are arbitrary pre-
cision numbers. This precision is both in the integer part and the
fractional part. All numbers are represented internally in decimal and
all computation is done in decimal. (This version truncates results
from divide and multiply operations.) |
|