System.Round

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function Round(X: Real): Int64;

Properties

Type Visibility Source Unit Parent
function public System.pas System System


Description

Returns the value of X rounded to the integer number.

In Delphi, the Round function rounds a real-type value to an integer-type value.

X is a real-type expression. Round returns an Int64 value that is the value of X rounded to an integer number. The default Rounding mode is rmNearest. If X is exactly halfway between two integer numbers, the result is always the even number. This method of rounding is often called "Banker's rounding."

If the rounded value of X is not within the Int64 range, a run-time error is generated that can be handled using the EInvalidOp exception.

Note: The behavior of Round can be affected by the Set8087CW procedure or System.Math.SetRoundMode function.

See Also

Code Examples