# System.Math.SimpleRoundTo

Delphi

```function SimpleRoundTo(const AValue: Single; const ADigit: TRoundToRange = -2): Single;
function SimpleRoundTo(const AValue: Double; const ADigit: TRoundToRange = -2): Double;
function SimpleRoundTo(const AValue: Extended; const ADigit: TRoundToRange = -2): Extended;
```

C++

```extern DELPHI_PACKAGE float __fastcall SimpleRoundTo(const float AValue, const TRoundToRange ADigit = (TRoundToRange)(0xfffffffe))/* overload */;
```

#### Properties

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

## Description

Rounds a floating-point value to a specified digit or power of ten using symmetric arithmetic rounding.

Call SimpleRoundTo to round `AValue` to a specified power of ten.

`ADigit` indicates the power of ten to which you want `AValue` rounded. It can be any value in the range from –37 through 37.

SimpleRoundTo returns the nearest value that has the specified power of ten. In case `AValue` is exactly in the middle of the two nearest values that have the specified power of ten (above and below), this function returns:

• The value toward plus infinity if `AValue` is positive.
• The value toward minus infinity if `AValue` is negative and the FPU rounding mode is not set to `rmUp`.

Note: The result of this function depends on the current FPU rounding mode. You can change the FPU rounding mode using the SetRoundMode function.

The following examples illustrate the results of SimpleRoundTo:

Expression

Value

`SimpleRoundTo(1234567, 3)`

1235000

`SimpleRoundTo(1.234, -2)`

1.23

`SimpleRoundTo(1.235, -2)`

1.24

`SimpleRoundTo(-1.235, -2)`

-1.23 or -1.24 (depending on the current FPU rounding mode)

To round in "Banker's mode", use System.Math.RoundTo.