安装 BC 和任何数学扩展

Rel*_*ser 12 12.04 bc software-installation

我需要安装bc(我认为这是一种语言,所以我猜我需要安装一个解析器,但我真的不知道 - 我需要安装其他任何东西吗?)到 Ubuntu 12.04 和任何其他存在的数学扩展。我发现尝试从这里下载它的唯一地方是从这里没有足够的说明让我能够实际完成这项工作。在网站上环顾四周,最后一次更新似乎是从 2000 年开始的,这让我对尝试安装它非常谨慎,我什至不确定是否可以从这里获取它。

我应该补充一点,我真的不知道我在做什么。我需要一个关于整个安装过程的白痴指南。

真的真的坚持这一点。

mur*_*uru 16

安装bc很简单:

sudo apt-get install bc
Run Code Online (Sandbox Code Playgroud)

至于扩展,man bc说:

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.
Run Code Online (Sandbox Code Playgroud)

实际上,联机帮助页充满了标记为“扩展”的内容。

使用以下-l选项应用数学扩展:

-l, --mathlib
      Define the standard math library.
Run Code Online (Sandbox Code Playgroud)

因此:

$ bc <<<'c(10)'
Runtime error (func=(main), adr=6): Function c not defined.
$ bc -l <<<'c(10)'
-.83907152907645245225
Run Code Online (Sandbox Code Playgroud)