Skip to content

Commit

Permalink
Math: Fix round() in calc command
Browse files Browse the repository at this point in the history
The second argument of `round()` has to be an integer, and since every
number is converted to a float to avoid using too much memory, a wrapper
has to be added for this function. I've tested it with big numbers and
it doesn't seem to cause any issue.
  • Loading branch information
nyuszika7h committed Mar 27, 2017
1 parent 5665f2f commit 7d299dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/Math/plugin.py
Expand Up @@ -120,7 +120,7 @@ def _factorial(x):
_mathEnv['abs'] = abs
_mathEnv['max'] = max
_mathEnv['min'] = min
_mathEnv['round'] = round
_mathEnv['round'] = lambda x, y: round(x, int(y))
_mathSafeEnv = dict([(x,y) for x,y in _mathEnv.items()])
_mathSafeEnv['factorial'] = _factorial
_mathRe = re.compile(r'((?:(?<![A-Fa-f\d)])-)?'
Expand Down

0 comments on commit 7d299dc

Please sign in to comment.