diff options
author | Reinier Heeres <reinier@heeres.eu> | 2010-07-26 07:09:11 (GMT) |
---|---|---|
committer | Reinier Heeres <reinier@heeres.eu> | 2010-07-26 07:09:11 (GMT) |
commit | 569b1093565bac92c6eaded7dad9442d878c09a9 (patch) | |
tree | 0fc55951a5087cf27025fda0746b6fef61e43316 /functions.py | |
parent | bc93657e57dea36a6dbe553bc2b1565bf03e81bd (diff) |
Fix SL #1713, #1909
Diffstat (limited to 'functions.py')
-rw-r--r-- | functions.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/functions.py b/functions.py index c777af3..c4a08f2 100644 --- a/functions.py +++ b/functions.py @@ -51,6 +51,7 @@ _FUNCTIONS = [ _('fac'), _('factorize'), _('floor'), + _('inv'), _('is_int'), _('ln'), _('log10'), @@ -64,6 +65,7 @@ _FUNCTIONS = [ _('sinc'), _('sqrt'), _('sub'), + _('square'), _('tan'), _('tanh'), _('xor'), @@ -260,6 +262,10 @@ def floor(x): return math.floor(float(x)) floor.__doc__ = _('floor(x), return the largest integer smaller than x.') +def inv(x): + return 1 / x +inv.__doc__ = _('inv(x), return the inverse of x, which is 1 / x') + def is_int(n): if type(n) in (types.IntType, types.LongType): return True @@ -389,6 +395,10 @@ sqrt.__doc__ = _( 'sqrt(x), return the square root of x. This is the value for which the square \ equals x. Defined for x >= 0.') +def square(x): + return x**2 +square.__doc__ = _('square(x), return x * x') + def sub(x, y): if isinstance(x, _Decimal) or isinstance(y, _Decimal): x = _d(x) |