System.Math.SetRoundMode
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 |
---|---|
|
Rounds to the closest integer value. |
|
Rounds toward negative infinity. |
|
Rounds toward positive infinity. |
|
Truncates the value, rounding positive numbers down and negative numbers up. |
See Also
- Floating-Point Number Control Routines
- About Floating-Point Arithmetic
- Floating-Point Rounding Routines
Code Examples