shell中浮点运算方式
2010-11-20 00:40
232 查看
用bc或awk
$a=3.4 b=345.3
echo "scale=4;$a*$b/2"|bc
587.0100
$echo $a*$b/2|bc -l
587.01000000000000000000
$awk 'BEGIN{printf '$a'*'$b'/2}'
587.01
$a=3.4 b=345.3
echo "scale=4;$a*$b/2"|bc
587.0100
$echo $a*$b/2|bc -l
587.01000000000000000000
$awk 'BEGIN{printf '$a'*'$b'/2}'
587.01
相关文章推荐
- shell脚本中如何处理浮点运算
- shell脚本只提供整数算术运算(三种方式)—((表达式))、let "表达式"、value=`expr 表达式右边` (转载)
- shell中浮点数运算
- shell 浮点运算
- SHELL 中的浮点运算
- Shell 下面的几种运算方式
- Shell浮点数运算
- shell中用bc进行浮点运算
- 通过shell进行数学运算的多种方式
- shell中用bc进行浮点运算
- shell中的浮点数运算
- 通过shell进行数学运算的多种方式
- shell 使用bc处理浮点数运算
- Shell脚本浮点运算
- shell浮点运算工具bc
- Bash shell 的算术运算有四种方式
- linux下使用shell做浮点运算
- shell浮点运算工具bc
- 通过shell进行数学运算的多种方式
- shell中用bc进行浮点运算(转帖)