Hi,

I need to find the square root of a number in a program I am writing. I have 
imported the 'math' module so I thought I could just call sqrt(x) but I get an 
error message. Extact from my code and error message below.


import sys, pygame, math

...

     if ypos >= 384 and velocity > 0:
         impactvel = sqrt(velocity ** 2 + (2 * gravity * (ypos - 384 * 160)))

...


Traceback (most recent call last):
   File "<stdin>", line 32, in <module>
ValueError: math domain error

This one has me stumped as the usage of the module looks straight forward from 
the documentation. Thanks for looking.

Matt



_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to