mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
For convenience, rounding to an integer value now also casts to integer.
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user