Floating point number operations in Linux
In this topic, let us learn how to perform operations on floating point numbers in Linux.
We know that we can use below ways to perform operations on Integer numbers.
- a=`expr $b + 1`
- let a=b-1
If you try to use floating point numbers in above commands, you will get error saying “non-integer argument”
In Linux, we can use “bc” command to perform operations on floating point numbers as shown in below examples.
- a=$(echo 2.3 + 3.4 | bc)