How can i devide decimal numbers?
I am getting this kind of error:
line 18: 200.2/40.234: syntax error in expression (error token is ".2/40.234")
What can i do to work around this problem?
Thanks for any advice.
How can i devide decimal numbers?
I am getting this kind of error:
line 18: 200.2/40.234: syntax error in expression (error token is ".2/40.234")
What can i do to work around this problem?
Thanks for any advice.
kcsdev:/home/jmcnama> var=`echo "scale=12; .2 / 40.234"|bc`
kcsdev:/home/jmcnama> echo $var
kcsdev:/home/jmcnama> .004970920117
[/code]
What does scale=12 mean?
I encountered another problem whenever i devide a smaller number by a bigger number i.e. 4/9 instead of getting the answer as 0.4444444444 i just get 0
Why is that, and what can i do t oget the right answer?
It's the same issue - the shell you're using can't deal with non-integers.
Use the same technique as jim has shown - pipe the expression through to the bc function.