我怎样才能获得浮师? [英] How can I get float division?
本文介绍了我怎样才能获得浮师?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Bash脚本来划分两个图像的宽度,但庆典给了我 0
的结果是:
I am trying to divide two image widths in a Bash script, but bash gives me 0
as the result:
RESULT=$(($IMG_WIDTH/$IMG2_WIDTH))
我做研究猛砸指南,我知道我应该使用 BC
,在他们使用互联网的所有例子 BC
。在回声
我试图把同样的事情在我的 SCALE
,但没有奏效。
I did study the Bash guide and I know I should use bc
, in all examples in internet they use bc
. In echo
I tried to put the same thing in my SCALE
but it didn't work.
下面是我在教程中找到的例子:
Here is the example I found in the tutorials:
echo "scale=2; ${userinput}" | bc
我怎样才能击给我一个浮动像 0.5
?
推荐答案
您不能。庆典的只有的不整数;您的必须的委托为这样的工具BC
。
You can't. bash only does integers; you must delegate to a tool such as bc
.
这篇关于我怎样才能获得浮师?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文