round

Round to nearest integer

Int round(Float)

Rounds a floating point number to the nearest integer based on standard rounding rules ("round half up").

Parameters:

  1. Float: the number to round.

Returns: An integer.

Example: test_round.wdl

version 1.3

workflow test_round {
  input {
    Int i1
  }

  Int i2 = i1 + 1
  Float f1 = i1 + 0.49
  Float f2 = i1 + 0.50

  output {
    Array[Boolean] all_true = [round(f1) == i1, round(f2) == i2]
  }
}

Example input:

{
  "test_round.i1": 2
}

Example output:

{
  "test_round.all_true": [true, true]
}