Originally Posted by
anduril462
I recommend GMP, and you pretty much need it if you want it to work with arbitrarily large numbers. Otherwise, you can try unsigned long long (or uint64_t), which will get you up to 18,446,744,073,709,551,615. Or you can try switching your floats to long doubles and use fmodl instead of %. That should get you up to 1.189731495357231765085759326628007 × 10^4932, though I haven't given any thought to how floating point inaccuracy might affect your algorithm, so that should be your last resort.