Standard library function round()
does not round half numbers up.
#698
Labels
interop
Bears on spec compatibility
round()
does not round half numbers up.
#698
Half numbers in miniwdl are rounded down instead of rounding up, which differs with the spec:
https://github.com/openwdl/wdl/blob/9c0b9cf4586508a9e6260cc5c5e562e21f625aac/SPEC.md?plain=1#L6279
The spec also has an example of this behavior (though the example json output is supposed to be
[true, true]
instead oftrue
.https://github.com/openwdl/wdl/blob/9c0b9cf4586508a9e6260cc5c5e562e21f625aac/SPEC.md?plain=1#L6289-L6306
With the WDL workflow below:
The output is:
Even though both integer outputs should be 3.
This may be due to how the round function is implemented.
miniwdl/WDL/StdLib.py
Line 69 in 5ccead0
It looks like the standard library function depends on python's round function, and python rounds half numbers towards the "even" choice.
https://docs.python.org/3/library/functions.html#round
The text was updated successfully, but these errors were encountered: