-
-
Notifications
You must be signed in to change notification settings - Fork 655
Description
Problem Description
I'm pretty sure sage wants to use all kinds of numbers without losing precision, or errors, since I can see sys.set_int_max_str_digits(0)
in all.py.
However, even with the limit set to 0 (unlimited) in all.py which is called during import, it still cannot handle 4301+ digits integers, because Python refuses to run if there's 4301+ digit number in the first place.
For example, the following sage code has the following error (the 11...11 is actually 5000 digits of 1):
long.sage
a = 11...11
sage long.sage
File "/home/soon_haari/mysage/long.sage.py", line 6
_sage_const_11...11
SyntaxError: Exceeds the limit (4300 digits) for integer string conversion: value has 5000 digits; use sys.set_int_max_str_digits() to increase the limit - Consider hexadecimal for huge integer literals to avoid decimal conversion limits.
In more details, 11...11
parses to Integer(11...11)
where 11...11 in Integer is supposed to be <class 'int'>
in Python.
I suggest it parses to Integer('11...11')
instead.
Funnily enough, real/complex numbers like 1.1
or 1j
or even 1.1j
have no problem due to long digits, because it parses to RealNumber('1.1')
, ComplexNumber(0, '1')
, ComplexNumber(0, '1.1')
which use string as arguments already. I suggest the same fix.
Proposed Solution
Make Integers use strings as arguments as well.
Alternatives Considered
.
Additional Information
Here's the PR:
#40178
Is there an existing issue for this?
- I have searched the existing issues for a bug report that matches the one I want to file, without success.