[Python-ideas] Python3.3 Decimal Library Released

Andrew Barnert abarnert at yahoo.com
Tue Mar 4 11:57:57 CET 2014


On Mar 4, 2014, at 1:18, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

> Antoine Pitrou wrote:
>> Well, unless you know by construction that your integer is a perfect
>> square.
> 
> If you've constructed it that way, you probably already
> know its square root.

Usually, but not always.

For example, there are algorithms to generate squares of Pythagorean triples without generating the triples themselves. Of course there are simpler and more efficient algorithms to just generate the triples (can't get much simpler than Euclid's formula...), but there might be some reason you're using one of the square algorithms. And then, to test it, you'd need to verify that a2+b2==c2 and that all three of them are perfect squares.


More information about the Python-ideas mailing list