Ubuntu – Installing BC and any maths extension

12.04bcsoftware installation

I need to install bc (I think this is a language so I am guessing I need to install a parser but I seriously have no clue – would I need to install anything else?) onto Ubuntu 12.04 and any additional maths extension that exists for it. The only place I found to try to download it from was from here which had insufficient instructions for me to be able to actually get this done. Looking around on the site the last update appears to be from the year 2000 which made me very wary of trying to install it and I am not even sure if this the place to get it from or not.

I ought to add I really have no clue what I am doing. I need an idiot's guide to the entire installation process.

Really really stuck on this.

Best Answer

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
Related Question