Installing BC and any maths extension
Solution 1:
Installing bc
is trivial:
sudo apt-get install bc
As for extensions, man bc
says:
DIFFERENCES
This version of bc was implemented from the POSIX P1003.2/D11 draft and
contains several differences and extensions relative to the draft and
traditional implementations.
Indeed, the manpage is full of things marked 'extension'.
The maths extensions are applied using the -l
option:
-l, --mathlib
Define the standard math library.
Thus:
$ bc <<<'c(10)'
Runtime error (func=(main), adr=6): Function c not defined.
$ bc -l <<<'c(10)'
-.83907152907645245225