On Mon, Mar 3, 2014 at 3:01 PM, Antoine Pitrou <solipsis@pitrou.net> wrote:
For the record, int doesn't have a sqrt() method while Decimal has, so
if you wanna take the exact square root of a large integer, you'd better
convert it to a Decimal.

Well, actually, if you want to take the square root of a large integer, most times you'll need an irrational number as a value.  Unfortunately, neither floats, decimals, nor fractions are able to do that (nor any finite representation that is numeric; you can only use symbolic ones).

On the other hand, now that you mention it, a floor_sqrt() function that operated quickly on ints would be nice to have.  But that's a different thread.


--
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.