Table of Contents

Method RoundHalfAwayFromZero

Namespace
DocWright.Core.Primitives
Assembly
DocWright.Core.dll

RoundHalfAwayFromZero(double)

Rounds a floating-point value to the nearest 32-bit integer, rounding midpoints away from zero (0.5 becomes 1, -0.5 becomes -1).

public static int RoundHalfAwayFromZero(double value)

Parameters

value double

The value to round. Must be finite.

Returns

int

The rounded value.

Exceptions

ArgumentOutOfRangeException

The value is NaN or infinite.

OverflowException

The rounded value does not fit in an int.