How to use 'python atan2' in Python

Every line of 'python atan2' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
39def safe_atan2(y, x):
40 if x == 0.0:
41 if y > 0:
42 return pi / 2.0
43 else:
44 return -pi / 2.0
45 else:
46 return atan2(y, x)

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

26@wrap(['space', float])
27def acos(space, d):
28 """ acos - Arc cosine """
29 try:
30 return space.wrap(math.acos(d))
31 except OverflowError:
32 return space.wrap(rfloat.INFINITY)
33 except ValueError:
34 return space.wrap(rfloat.NAN)

Related snippets