mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-07 19:49:23 +01:00
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.
This commit is contained in:
parent
5665f2f477
commit
7d299dc3d1
@ -120,7 +120,7 @@ class Math(callbacks.Plugin):
|
|||||||
_mathEnv['abs'] = abs
|
_mathEnv['abs'] = abs
|
||||||
_mathEnv['max'] = max
|
_mathEnv['max'] = max
|
||||||
_mathEnv['min'] = min
|
_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 = dict([(x,y) for x,y in _mathEnv.items()])
|
||||||
_mathSafeEnv['factorial'] = _factorial
|
_mathSafeEnv['factorial'] = _factorial
|
||||||
_mathRe = re.compile(r'((?:(?<![A-Fa-f\d)])-)?'
|
_mathRe = re.compile(r'((?:(?<![A-Fa-f\d)])-)?'
|
||||||
|
Loading…
Reference in New Issue
Block a user