For convenience, rounding to an integer value now also casts to integer.

This commit is contained in:
Dion Moult
2023-09-08 11:15:01 +10:00
parent f1c3a90bc5
commit e897797955
@@ -189,7 +189,11 @@ class FormatTransformer(lark.Transformer):
def round(self, args):
value = args[0] or 0.0
return str(round(float(value) / float(args[1])) * float(args[1]))
nearest = float(args[1])
result = round(float(value) / nearest) * nearest
if nearest % 1 == 0:
return str(int(result))
return str(result)
def format_length(self, args):
return args[0]