Created
December 23, 2022 13:40
-
-
Save joelonsql/7d5f8c664c9a33c7acf0db7d8958bccd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const bigint = std.math.big.int.Managed; | |
pub fn main() !void { | |
var a = try bigint.initSet(std.heap.c_allocator, 5); | |
try a.pow(&a, try std.math.powi(u32, 4, try std.math.powi(u32, 3, 2))); | |
defer a.deinit(); | |
var as = try a.toString(std.heap.c_allocator, 10, .lower); | |
defer std.heap.c_allocator.free(as); | |
std.debug.print("{s}...{s}\n", .{ as[0..20], as[as.len - 20 ..] }); | |
std.debug.print("{} digits\n", .{as.len}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment