- Published on

# bc command-floating point operations

Jonas

1 min read

The English spelling of bc is "Binary Calculator", which is a calculator language that supports arbitrary precision interactive execution. Bash has built-in support for the four arithmetic operations of integers, but does not support floating-point operations. The bc command can easily perform floating-point operations. Of course, integer operations are no longer a problem.

**Syntax**: bc [options]

##### Command parameters

-i | Force into interactive mode |

-l | Define the standard math library used |

-w | Define the standard math library used |

-q | Print normal GNU bc environment information |

##### Example

Arithmetic operations advanced operations bc command It can perform floating-point operations and some advanced functions:

[root@linuxstar ~]# echo "1.212*3" | bc 3.636

Set decimal precision (numerical range):

[root@linuxstar ~]# echo "scale=2;3/8" | bc .37

Calculate the square and square root:

[root@linuxstar ~]# echo "10^10" | bc 10000000000 [root@linuxstar ~]# echo "sqrt(100)" | bc 10