Skip to main content
Added a reference link.
Source Link
Kannan Mohan
  • 3.3k
  • 2
  • 20
  • 16

My suggestion is that use bc for arithmetic operation and <<< "Here String"(Here String) for inputting the values to bc.

$ mPercent=3.27
$ fPercent=3.27

$ bc -l <<< "$mPercent / 100 * .482 + $fPercent / 100 * .518"
.03270000000000000000

Here -l option to bc will allow you to use floating point arithmetic with more mathematical functions.

My suggestion is that use bc for arithmetic operation and <<< "Here String" for inputting the values to bc.

$ mPercent=3.27
$ fPercent=3.27

$ bc -l <<< "$mPercent / 100 * .482 + $fPercent / 100 * .518"
.03270000000000000000

Here -l option to bc will allow you to use floating point arithmetic with more mathematical functions.

My suggestion is that use bc for arithmetic operation and <<< (Here String) for inputting the values to bc.

$ mPercent=3.27
$ fPercent=3.27

$ bc -l <<< "$mPercent / 100 * .482 + $fPercent / 100 * .518"
.03270000000000000000

Here -l option to bc will allow you to use floating point arithmetic with more mathematical functions.

Source Link
Kannan Mohan
  • 3.3k
  • 2
  • 20
  • 16

My suggestion is that use bc for arithmetic operation and <<< "Here String" for inputting the values to bc.

$ mPercent=3.27
$ fPercent=3.27

$ bc -l <<< "$mPercent / 100 * .482 + $fPercent / 100 * .518"
.03270000000000000000

Here -l option to bc will allow you to use floating point arithmetic with more mathematical functions.