mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix some of the new math filters
This commit is contained in:
parent
7ab1e52575
commit
c808c8a22a
1 changed files with 4 additions and 4 deletions
|
@ -21,7 +21,7 @@ from ansible import errors
|
||||||
def isnotanumber(x):
|
def isnotanumber(x):
|
||||||
try:
|
try:
|
||||||
return math.isnan(x)
|
return math.isnan(x)
|
||||||
except TypeError, e:
|
except TypeError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,12 +30,12 @@ def logarithm(x, base=math.e):
|
||||||
if base == 10:
|
if base == 10:
|
||||||
return math.log10(x)
|
return math.log10(x)
|
||||||
else:
|
else:
|
||||||
return = math.log(x, base)
|
return math.log(x, base)
|
||||||
except TypeError, e:
|
except TypeError, e:
|
||||||
raise errors.AnsibleFilterError('log() can only be used on numbers: %s' % str(e))
|
raise errors.AnsibleFilterError('log() can only be used on numbers: %s' % str(e))
|
||||||
|
|
||||||
|
|
||||||
def power(x):
|
def power(x, y):
|
||||||
try:
|
try:
|
||||||
return math.pow(x, y)
|
return math.pow(x, y)
|
||||||
except TypeError, e:
|
except TypeError, e:
|
||||||
|
|
Loading…
Reference in a new issue