4 ms·
Python has arbitrary precision integers, so you could do it without running into overflows. Although if implementing floating point based technique, you may wan
by abhi9u 3y ago
Python has arbitrary precision integers, so you could do it without running into overflows. Although if implementing floating point based technique, you may want to use np.float128 to handle values upto 10^4932.
- gs17 3y ago> you may want to use np.float128 to handle values upto 10^4932. I'm not sure the maximum value matters, since I think it only actually gives you 33 decimal digits precision and the 1500th number has over 300 digits. Although it looks like you'd need to be more careful with it too: https://numpy.org/doc/stable/user/basics.types.html https://numpy.org/doc/stable/user/basics.types.html > np.float96 and np.float128 are provided for users who want specific padding. In spite of the names, np.float96 and np.float128 provide only as much precision as np.longdouble, that is, 80 bits on most x86 machines and 64 bits in standard Windows builds.
- abhi9u 3y agoMy bad. I should have looked into the docs. Thanks for pointing out!