Ask Your Question

Revision history [back]

Your n is not the square of 2^128:

sage: n=115792089237316195423570985008687907852837564279074904382605163141518161494337                                                                    
sage: (2^128)^2 - n                                                             
432420386565659656852420866394968145599

But, if you use float, then the precision of floats (53 bits of precision) is not enough to see a difference:

sage: float((2^128)^2) - float(n)                                               
0.0

So, don't use float and don't use math.sqrt which returns float to compute such equalities or differences:

sage: type(math.sqrt(n))                                                        
<class 'float'>