# std.bigint

Arbitrary-precision ('bignum') arithmetic.

Performance is optimized for numbers below ~1000 decimal digits. For X86 machines, highly optimised assembly routines are used.

The following algorithms are currently implemented:

• Karatsuba multiplication
• Squaring is optimized independently of multiplication
• Divide-and-conquer division
• Binary exponentiation

For very large numbers, consider using the GMP library instead.

## Members

### Functions

absUnsign
Unsigned!T absUnsign(T x)

Returns the absolute value of x converted to the corresponding unsigned type.

divMod
void divMod(BigInt dividend, BigInt divisor, BigInt quotient, BigInt remainder)

Finds the quotient and remainder for the given dividend and divisor in one operation.

powmod
BigInt powmod(BigInt base, BigInt exponent, BigInt modulus)

Fast power modulus calculation for BigInt operands.

toDecimalString
string toDecimalString(const(BigInt) x)
toHex
string toHex(const(BigInt) x)

### Structs

BigInt
struct BigInt

A struct representing an arbitrary precision integer.
{"ft_lang_label":"__label__en","ft_lang_prob":0.7739655,"math_prob":0.93823564,"size":556,"snap":"2023-14-2023-23","text_gpt3_token_len":100,"char_repetition_ratio":0.08695652,"word_repetition_ratio":0.0,"special_character_ratio":0.17805755,"punctuation_ratio":0.123595506,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9937397,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-05-28T02:37:02Z\",\"WARC-Record-ID\":\"<urn:uuid:7bef0f82-6d59-45e9-b73f-92606cf2260e>\",\"Content-Length\":\"9097\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:11968b7f-e121-4b69-b92b-c078b7fc1d8d>\",\"WARC-Concurrent-To\":\"<urn:uuid:aa1662e0-6da2-4381-b6d5-e1f685d38e47>\",\"WARC-IP-Address\":\"104.236.209.158\",\"WARC-Target-URI\":\"https://phobos.dpldocs.info/std.bigint.html\",\"WARC-Payload-Digest\":\"sha1:P5Z5DOYSVWLREWGDPLVK3QD7AAOXTUJP\",\"WARC-Block-Digest\":\"sha1:DLFPY7XCDILGH3O2N255OYMP6K6JG5RP\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-23/CC-MAIN-2023-23_segments_1685224643462.13_warc_CC-MAIN-20230528015553-20230528045553-00224.warc.gz\"}"}