How to add decimal numbers in Linux
Can anyone specify the methods how to add decimal numbers in Linux
|
In what context? You mean from the shell? If so, `bc` would be my first choice, although `awk` can also to arithmetic.
|
Bash, and I assume any Korn oriented shell, cannot do floating point arithmetic. Almost any other programming environment can.
--- rod. |
Hi.
Many shells can do integer arithmetic. Versions of ksh of at least ksh 93s+ can do floating point arithmetic, see man ksh. Also zsh, see post # 11, http://www.linuxquestions.org/questi...script-336772/ Best wishes ... cheers, makyo |
to do calculation, use bc,dc , awk.
|
Or fire up Python, which has those capabilities (and much more, start by importing things from math):
Code:
python Edit: or if you're fine with typing, you could just Code:
python -c 'print .2+.8' |
All times are GMT -5. The time now is 07:35 AM. |