[Python-ideas] Python3.3 Decimal Library Released

David Mertz mertz at gnosis.cx
Tue Mar 4 03:17:18 CET 2014


On Mon, Mar 3, 2014 at 3:10 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:

> On Mon, 3 Mar 2014 15:07:57 -0800
> David Mertz <mertz at gnosis.cx> wrote:
> > On Mon, Mar 3, 2014 at 3:01 PM, Antoine Pitrou <solipsis at 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.
>
> Well, unless you know by construction that your integer is a perfect
> square.
>

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?

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.

-- 
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140303/799961a0/attachment.html>


More information about the Python-ideas mailing list