If you are running 32-bit 3.6 on Windows, please test this
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Thu Aug 31 01:13:37 EDT 2017
On Wed, 30 Aug 2017 20:46:54 -0400, Terry Reedy wrote:
> On 8/30/2017 1:35 PM, Terry Reedy wrote:
>> https://stackoverflow.com/questions/45965545/math-sqrt-domain-error-
when-square-rooting-a-positive-number
[...]
> Three people have reported that math.sqrt(1.3) works in 32 bit Python on
> 64-bit Windows and no one otherwise. I reported back on SO that the
> problem is likely local. Thanks for the responses.
I wouldn't entirely rule out a bug yet.
Do the Python Devs have a windows build-bot? If so, perhaps:
- it is currently failing, and nobody noticed;
- it's not failing, because the tests don't cover this case.
The tests for sqrt are not exactly extensive, and the poster on SO
reports sqrt only fails on *some* numbers, not all.
https://github.com/python/cpython/blob/master/Lib/test/test_math.py
def testSqrt(self):
self.assertRaises(TypeError, math.sqrt)
self.ftest('sqrt(0)', math.sqrt(0), 0)
self.ftest('sqrt(1)', math.sqrt(1), 1)
self.ftest('sqrt(4)', math.sqrt(4), 2)
self.assertEqual(math.sqrt(INF), INF)
self.assertRaises(ValueError, math.sqrt, -1)
self.assertRaises(ValueError, math.sqrt, NINF)
self.assertTrue(math.isnan(math.sqrt(NAN)))
As far as I can see, apart from tests for NAN and ±INF, there are no
tests of math.sqrt on floats at all.
--
Steven D'Aprano
“You are deluded if you think software engineers who can't write
operating systems or applications without security holes, can write
virtualization layers without security holes.” —Theo de Raadt
More information about the Python-list
mailing list