我做了一些搜索,显然根据 this 标准库中曾经有一个 Bignum 模块。但此时我在标准库中看不到任何东西。
最佳答案
核心 OCaml 发行版中没有 bignum 模块。 official recommendation是使用第三方 Zarith
library ,特别是它的 Z
module .
如果您已将 OCaml 作为操作系统分发的一部分安装,请查看它是否有用于 Zarith 的软件包。例如,在 Debian、Ubuntu 和衍生产品上,它是 libzarith-ocaml-dev
.如果 Zarith 在您的操作系统中不可用,请使用 OPAM 安装它:
opam install zarith
构建应用程序时,使用以下之一进行编译ocamlc -I +zarith zarith.cma …
ocamlopt -I +zarith zarith.cmxa …
ocamlfind <COMMAND> -package zarith -linkpkg …
要在顶层使用 Zarith:ocaml -I +zarith zarith.cma zarith_top.cma
旧版本的 Ocaml 在标准发行版中有一个 bignum 模块(但标准库中没有:它不需要单独安装,但必须显式链接)。是 nums
library , 及其主模块Num
.从 OCaml 4.06 , nums
图书馆是 distributed separately .从技术上讲,标准库中没有 bignum 模块,因为 Ocaml 术语中的标准库是编译程序的默认库,并且其中没有 bignum 模块。也没有
Bignum
library — 因为 bignum 库被称为 nums
,其主模块名为Num
.在 Ocaml 被称为 Ocaml 之前,它一直是标准 Ocaml 发行版的一部分,现在仍然如此。
关于ocaml - Ocaml 有 Bignum 模块吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7680499/