Round()

MathF::Round(float) method

Rounds the specified value to the nearest integral value.

static float System::MathF::Round(float a)

Arguments

ParameterTypeDescription
afloatThe value to round

Return Value

a rounded to the nearest integral value

MathF::Round(float, int) method

Rounds the specified value to the nearest value with the specified number of fractional digits.

static float System::MathF::Round(float value, int digits)

Arguments

ParameterTypeDescription
valuefloatThe value to round
digitsintThe number of fractional digits in the rounded value

Return Value

The number with the specified number of digits nearest to value

MathF::Round(float, MidpointRounding) method

Rounds the specified value to the nearest integral number. A parameter specifies the function’s behavior if the specified value is equally close to two nearest numbers.

static float System::MathF::Round(float value, MidpointRounding mode)

Arguments

ParameterTypeDescription
valuefloatThe value to round
modeMidpointRoundingSpecifies how to perform the rounding if value is equally close to two nearest numbers.

Return Value

value rounded to the nearest integral value

MathF::Round(float, int, MidpointRounding) method

Rounds the specified value to the nearest value with the specified number of fractional digits. A parameter specifies the function’s behavior if the specified value is equally close to two nearest numbers.

static float System::MathF::Round(float value, int digits, MidpointRounding mode)

Arguments

ParameterTypeDescription
valuefloatThe value to round
digitsintThe number of fractional digits in the rounded value
modeMidpointRoundingSpecifies how to perform the rounding if value is equally close to two nearest numbers.

Return Value

The number with the specified number of digits nearest to value

See Also