Click or drag to resize

PrecisionRound(Double, 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 double Round(
	this double number,
	int digits
)

Parameters

number  Double
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

Double
Rounded number

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Double. 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