Прочитать на английском Изменить

Поделиться через


Single.Round Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

Round(Single)

Rounds a value to the nearest integer using the default rounding mode (ToEven).

Round(Single, Int32)

Rounds a value to a specified number of fractional-digits using the default rounding mode (ToEven).

Round(Single, MidpointRounding)

Rounds a value to the nearest integer using the specified rounding mode.

Round(Single, Int32, MidpointRounding)

Rounds a value to a specified number of fractional-digits using the default rounding mode (ToEven).

Round(Single)

Source:
Single.cs
Source:
Single.cs
Source:
Single.cs

Rounds a value to the nearest integer using the default rounding mode (ToEven).

public static float Round(float x);

Parameters

x
Single

The value to round.

Returns

The result of rounding x to the nearest integer using the default rounding mode.

Implements

Applies to

.NET 10 и другие версии
Продукт Версии
.NET 7, 8, 9, 10

Round(Single, Int32)

Source:
Single.cs
Source:
Single.cs
Source:
Single.cs

Rounds a value to a specified number of fractional-digits using the default rounding mode (ToEven).

public static float Round(float x, int digits);

Parameters

x
Single

The value to round.

digits
Int32

The number of fractional digits to which x should be rounded.

Returns

The result of rounding x to digits fractional-digits using the default rounding mode.

Implements

Applies to

.NET 10 и другие версии
Продукт Версии
.NET 7, 8, 9, 10

Round(Single, MidpointRounding)

Source:
Single.cs
Source:
Single.cs
Source:
Single.cs

Rounds a value to the nearest integer using the specified rounding mode.

public static float Round(float x, MidpointRounding mode);

Parameters

x
Single

The value to round.

mode
MidpointRounding

The mode under which x should be rounded.

Returns

The result of rounding x to the nearest integer using mode.

Implements

Applies to

.NET 10 и другие версии
Продукт Версии
.NET 7, 8, 9, 10

Round(Single, Int32, MidpointRounding)

Source:
Single.cs
Source:
Single.cs
Source:
Single.cs

Rounds a value to a specified number of fractional-digits using the default rounding mode (ToEven).

public static float Round(float x, int digits, MidpointRounding mode);

Parameters

x
Single

The value to round.

digits
Int32

The number of fractional digits to which x should be rounded.

mode
MidpointRounding

The mode under which x should be rounded.

Returns

The result of rounding x to digits fractional-digits using mode.

Implements

Applies to

.NET 10 и другие версии
Продукт Версии
.NET 7, 8, 9, 10