Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Type error in sage: long is too large to convert to float

I am new in sage and I have been trying for hours to fix the type issue. I used every possible data type in Python (e.g. Decimal, long and etc.) but no luck. I don't want to introduce a new data type in code. It would be great if the error could be fixed and X and Y be long a data type. Thank you so much in Advance.

Code:

 N = long(
    '16260595201356777876687102055392856230368799478725437225418970788404092751540966827614883675066492383688147288741223234174448378892794567789551235835087027626536919406320142455677084743499141155821894102610573207343199194327005172833989486958434982393556326206485954223151805798621294965926069728816780985683043030371485847746616146554612001066554175545753760388987584593091716701780398711910886679925612838955858736102229719042291682456480437908426849734556856917891628730543729446245974891735371991588505429152639045721840213451875487038496578525189542369448895368117152818687795094021869963915318643663536132393791')

e = long(
    '9278586176415637407263159408578691920359333372454377369719770617047980280946772628715887544861771332603998512490412112310956902919491486170574088276198189495386333836465063768828129359301433517440718437381660454785705721525097974857636068871096713768626273297901238473071056637845492072479070936932798180576585796558683754435768607883046039584737510259185971806751698550158026249176801507619064529443818304150648599396688870660401080227889827572469510021064725085334872793878678034795523371228947902585424135292996464136649558065449053206564552616679643325831942423442776280981153068472730957010986456115236454025653')

delta = float(0.26)
m = 4

t = int((1 - 2 * delta) * m)
X = 2 * floor(N ^ delta)
Y = floor(N ^ (1 / 2))

Error:

Traceback (most recent call last):   File "RSA/boneh_durfee.sage.py", line 306, in <module>
    X = _sage_const_2  * floor(N ** delta)  # this _might_ be too much OverflowError: long int too large to convert to float