Click or drag to resize

PrecisionRound(Single, Int32) Method

Round to the number closest to 10^(-decimals). Negative decimals to round within the integer part.

Namespace: Altaxo.Calc
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3179.0 (4.8.3179.0)
Syntax
C#
public static float Round(
	this float number,
	int digits
)

Parameters

number  Single
Number to be rounded
digits  Int32
If positive the number of decimals to round to. If negative the number of digits within the integer part to round, e.g. -3 will wound to the closes 1000.

Return Value

Single
Rounded number

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Single. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Example
To round 123456789 to hundreds Round(123456789, -2) = 123456800
See Also