Exactly what it says on the tin, you give it a significand (floating point) and exponent (integer) type, and it gives you back large numbers. I made an ad-hoc demo and game to demonstrate the absurd numbers this library can handle:
Source code:
Why?
Inspired by Universal Paperclips and Antimatter Dimensions, I’ve been wanting to make an incremental game with the ultimate goal of compiling a native apk so that I can play on my phone.
Antimatter Dimensions’s number library is open-source, but given how long simulating offline progress takes in the later stages of the game, I wanted something faster. I haven’t compared them directly, but given these benchmarks 1 2, I expect my library to be 10x-50x faster.
Why not GMP?
I did try GMP initially but had trouble packaging it with a build.zig (I don’t have experience with make so figuring out cross-compilation would probably be a nightmare for me). If the game ever gets any traction, there’ll probably be a speedrunning community, so I also wanted cross-platform determinism, which means probably studying GMP’s code to make sure of it. I decided it would be easier to make my own library from scratch (silly me was happily unaware of how difficult that would be).