This is the rather old issue of how numbers are represented in these standard number formats. I won't pretend to hold class about what numbers fit into each number type but when you get into this you have to use a number format that works, adjust your own scaling or move to systems that support your numbers.
It's been many years since I've use BIGNUM in C but for Python it's over at https://pypi.org/project/BigNumber/
The PHP BIGNUM library might be at https://github.com/hpez/PHPBignum
However, in statistics any number past a few decimal places is not telling us much. You didn't make it clear how many digits would be the correct value for 1/3 or even Pi. Those are never ending so how do you intend to deal with this?