System.Math.SetRoundMode

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function SetRoundMode(const RoundMode: TRoundingMode): TRoundingMode;

C++

extern DELPHI_PACKAGE TRoundingMode __fastcall SetRoundMode(const TRoundingMode RoundMode);

Properties

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

Description

Sets the rounding mode for floating-point calculations.

Call SetRoundMode to specify how number rounding issues are handled. The value of the rounding mode determines certain rules that can affect the result. With the default rounding mode (rmNearest), if X is exactly halfway between two whole numbers, the result is always the even number.

The rounding mode can be any of the following values.

Value Meaning

rmNearest

Rounds to the closest integer value.

rmDown

Rounds toward negative infinity.

rmUp

Rounds toward positive infinity.

rmTruncate

Truncates the value, rounding positive numbers down and negative numbers up.

See Also

Code Examples