MathNRoundTNumeric(TNumeric, Int32, MidpointRounding) Method
Rounds a value to a specified number of fractional digits, and rounds midpoint values to the nearest even number.
Namespace: Jodosoft.NumericsAssembly: Jodosoft.Numerics (in Jodosoft.Numerics.dll) Version: 2.0
public static TNumeric Round<TNumeric>(
TNumeric x,
int digits,
MidpointRounding mode
)
where TNumeric : struct, new(), INumeric<TNumeric>
Public Shared Function Round(Of TNumeric As {Structure, New, INumeric(Of TNumeric)}) (
x As TNumeric,
digits As Integer,
mode As MidpointRounding
) As TNumeric
public:
generic<typename TNumeric>
where TNumeric : value class, gcnew(), INumeric<TNumeric>
static TNumeric Round(
TNumeric x,
int digits,
MidpointRounding mode
)
static member Round :
x : 'TNumeric *
digits : int *
mode : MidpointRounding -> 'TNumeric when 'TNumeric : struct, new() and INumeric<'TNumeric>
- x TNumeric
-
- digits Int32
- The number of fractional digits in the return value.
- mode MidpointRounding
-
- TNumeric
TNumericThe number nearest to
value that contains a number of fractional digits equal to
digits.
This method may return
NaN or Infinity.
If
NaN or Infinity cannot be represented by
TNumeric,
then this method may throw an
ArithmeticException.