Files
codeql/python/ql/test/query-tests/Numerics/pythagorean_test.py
Rasmus Lerchedahl Petersen b5b2d56bfa Add pythagorean query
2019-05-01 13:16:40 +02:00

14 lines
251 B
Python

# Computing the Euclidian norm using the Pythagorean Theorem
from math import sqrt
def withPow(a, b):
return sqrt(a**2 + b**2)
def withMul(a, b):
return sqrt(a*a + b*b)
def withRef(a, b):
a2 = a**2
b2 = b*b
return sqrt(a2 + b2)