big_int

FreeBASIC

big_int
 
Library for using arbitrarily large integers. Note: This library seems to be dead, a possible alternative is gmp.

Website: http://valyala.narod.ru/big_int/ (Russian) [the site apparently is gone]
Platforms supported: Win32, Linux
Headers to include: big_int/big_int.bi
Header version: from 2005
Examples: in examples/math/big_int/

Example

#include once "big_int/big_int_full.bi"

Sub print_num(ByVal num As big_int Ptr)
    Dim As big_int_str Ptr s = big_int_str_create(1)
    If (s = 0) Then
        Exit Sub
    End If

    If (big_int_to_str(num, 10, s) <> 0) Then
        Exit Sub
    End If

    Print *s->Str;

    big_int_str_destroy(s)
End Sub

    Dim As big_int Ptr bignum = big_int_create(1)

    big_int_from_int(2, bignum)
    big_int_pow(bignum, 65536, bignum)

    Print "2^65536 = ";
    print_num(bignum)
    Print

    big_int_destroy(bignum)