ROUNDTOEVEN Function

Purpose

Returns the value of x rounded to the nearest even number at a digit specified by n.

Syntax

ROUNDTOEVEN(x,n)

Parameters

x
A FIXED DECIMAL or DFP FLOAT expression to be rounded. If x is a negative value, the nearest even value is rounded and the sign is retained.
n
The digit at which rounding occurs. Can optionally be signed.

Description

ROUNDTOEVEN rounds numbers ending in 0.5 to the nearest even digit. For example, both 99.5 and 100.5 are rounded to 100, and -99.5 and -100.5 are rounded to -100.

For numbers not ending in 0.5, ROUNDTOEVEN is equivalent to ROUNDAWAYFROMZERO. For example, 100.6 is rounded to 101 and 100.4 is rounded to 100.

Restrictions

ROUNDTOEVEN is supported for FLOAT DFP only.