<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Mar 3, 2014 at 3:10 PM, Antoine Pitrou <span dir="ltr"><<a href="mailto:solipsis@pitrou.net" target="_blank">solipsis@pitrou.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Mon, 3 Mar 2014 15:07:57 -0800<br>
David Mertz <<a href="mailto:mertz@gnosis.cx">mertz@gnosis.cx</a>> wrote:<br>
> On Mon, Mar 3, 2014 at 3:01 PM, Antoine Pitrou <<a href="mailto:solipsis@pitrou.net">solipsis@pitrou.net</a>> wrote:<br>
>> > For the record, int doesn't have a sqrt() method while Decimal has, so<br>
> > if you wanna take the exact square root of a large integer, you'd better<br>
> > convert it to a Decimal.<br>
> Well, actually, if you want to take the square root of a large integer,<br>
> most times you'll need an irrational number as a value.<br>
<br>
</div>Well, unless you know by construction that your integer is a perfect<br>
square.<br></blockquote><div><br></div><div>Umm... if you construct your integer as a perfect square, wouldn't it be easier just to store the number it is a perfect square of than to work on optimizing the integer sqrt() function?</div>
<div><br></div><div>It does make me wonder--although this is definitely not actually python-ideas--whether there is any technique to determine if a number is a perfect square that takes less work than finding its integral root. Maybe so, I don't know very much number theory.</div>
</div><div><br></div>-- <br>Keeping medicines from the bloodstreams of the sick; food <br>from the bellies of the hungry; books from the hands of the <br>uneducated; technology from the underdeveloped; and putting <br>advocates of freedom in prisons. Intellectual property is<br>
to the 21st century what the slave trade was to the 16th.<br>
</div></div>