From 7d299dc3d1dc31cf50ba0583bd548d3f132ecffb Mon Sep 17 00:00:00 2001 From: nyuszika7h Date: Mon, 27 Mar 2017 16:35:33 +0200 Subject: [PATCH] Math: Fix round() in calc command 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. --- plugins/Math/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Math/plugin.py b/plugins/Math/plugin.py index 59581a891..532eb3745 100644 --- a/plugins/Math/plugin.py +++ b/plugins/Math/plugin.py @@ -120,7 +120,7 @@ class Math(callbacks.Plugin): _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'((?:(?