[Python-Dev] Math.sqrt(-1) -- nan or ValueError?

Hasan Diwan hasan.diwan at gmail.com
Wed Sep 5 00:13:50 CEST 2007

On 04/09/07, Guido van Rossum <guido at python.org> wrote:
> Is this on OSX? That test has been failing (because on that platform
> sqrt(-1) returns nan instead of raising ValueError) for years -- but
> the test is only run when run in verbose mode, which mostly hides the
> issue.  Have you read the comment for the test?

Indeed, I am on OSX. Yes, I have read the comment for the test. Would the
following pseudocode be an acceptable fix for the problem:
if sys.platform == 'darwin' and math.sqrt(-1) == nan:
     x = math.sqrt(-1)
  except ValueError:
or should I just not bother?
Hasan Diwan <hasan.diwan at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20070904/a598e9d5/attachment.htm 

More information about the Python-Dev mailing list