Table of Contents

RoundOffAccuracy Enum

Definition

Namespace
Cuemon.Extensions
Assemblies
Cuemon.Extensions.Core.dll
Source
src/Cuemon.Extensions.Core/RoundOffAccuracy.cs

The accuracy of a rounding for a computed number.

public enum RoundOffAccuracy
Extension Methods

Fields

NearestHundredThousandth = 100000

Specifies a rounding to the nearest hundred thousandth of a number.

NearestHundredth = 100

Specifies a rounding to the nearest hundredth of a number.

NearestMillion = 1000000

Specifies a rounding to the nearest million of a number.

NearestTenThousandth = 10000

Specifies a rounding to the nearest ten thousandth of a number.

NearestTenth = 10

Specifies a rounding to the nearest tenth of a number.

NearestThousandth = 1000

Specifies a rounding to the nearest thousandth of a number.

Examples

The following example demonstrates how to use the enum with the extension method to round double values to the nearest specified accuracy.

// Program.cs
using System;
using Cuemon.Extensions;

double value = 123456789.987654321d;

Console.WriteLine(value.RoundOff(RoundOffAccuracy.NearestTenth));
Console.WriteLine(value.RoundOff(RoundOffAccuracy.NearestHundredth));
Console.WriteLine(value.RoundOff(RoundOffAccuracy.NearestThousandth));
Console.WriteLine(value.RoundOff(RoundOffAccuracy.NearestMillion));