Skip to content
This repository has been archived by the owner. It is now read-only.
big numbers for zig
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bench Rename BigInt -> Int Jun 8, 2018
.gitignore Initial commit May 23, 2017
LICENSE Add license file May 26, 2017
README.md Add note regarding deprecation in favour of std Apr 24, 2019
int.zig Update for value-type parameters Mar 26, 2019
rational.zig Update for value-type parameters Mar 26, 2019

README.md

This is now merged into the zig stdlib.

An arbitrary precision big integer library for zig.

The interface is akin to that of GMP.

const std = @import("std");
const ArenaAllocator = std.heap.ArenaAllocator;

const BigInt = @import("bigint.zig").BigInt;

pub fn main() !void {
    const arena = ArenaAllocator.init(std.debug.global_allocator);
    defer arena.deinit();
    var al = arena.allocator;

    var a = try BigInt.init(al);
    var b = try BigInt.init(al);

    try a.set(1990273423429836742364234234234);
    try b.set(1990273423429836742364234234234);

    try a.add(&a, &b);
    try a.mul(&a, &b);

    try a.mul(&a, 14343);
}
You can’t perform that action at this time.