What bignum libraries work with D?

I need a bignum library to represent large integers. What options do I have with the D programming language? Are there, for example, GMP bindings?

Update:

I am trying to use the built-in BigInt as described below, but it seems like it is not available in GDC.

import std.bigint; import std.stdio; void main() { BigInt n = "123"; writefln(n); } 

When I try to compile this code with gdc main.d , they tell me that it cannot find bigint.d. Gdc only implements part of the library or am I doing something wrong?

+6
source share
2 answers

If you are looking for a large integer type, then BigInt in the standard library. On the other hand, if you are specifically planning to use GMP, you just need to make extern(C) declarations for the corresponding types and functions in GMP, and you can call them directly from D. Check out this page for more information about how to use C code in D.

+5
source

Paul Anderson is working on the BigFloat abstraction for the standard library.

+4
source

Source: https://habr.com/ru/post/897552/


All Articles