round function

Input type Output type
float
complex
int
complex

If the fractional part of the float argument is smaller than 0.5, this function rounds the argument down and returns the result. If the fractional part of the float argument is greater than or equal to 0.5, this function rounds the argument up and returns the result. For complex arguments, the function is defined as follows:

round(a + bi) = round(a) + round(b) * i

If the argument is of type int, it is first converted to float by the compiler.

Examples:

  round(3.2)       ; 3  round(3.8)       ; 4  round(6)         ; 6  round(-3.2)      ; -3  round(-3.8)      ; -4  round((3.2, 7))  ; (3, 7)    

Note: round(x) is equal to trunc(x + 0.5), or trunc(x + (0.5, 0.5)) for complex x.

See Also
trunc function
ceil function
floor function

round function