Table of Contents

Class DoubleExtensions

Namespace
Cuemon.Extensions
Assembly
Cuemon.Extensions.Core.dll

Extension methods for the Double struct.

public static class DoubleExtensions
Inheritance
DoubleExtensions

Methods

Factorial(Double)

Calculates the factorial of a positive integer n denoted by n!.

public static double Factorial(this double n)

Parameters

n Double

The positive integer to calculate a factorial number by.

Returns

Double

The factorial number calculated from n, or PositiveInfinity if n is to high a value.

Exceptions

ArgumentOutOfRangeException

n is lower than 0.

FromUnixEpochTime(Double)

Converts the specified input of an UNIX Epoch time to its equivalent DateTime structure.

public static DateTime FromUnixEpochTime(this double input)

Parameters

input Double

The Double to extend.

Returns

DateTime

A DateTime that is equivalent to input.

RoundOff(Double, RoundOffAccuracy)

Rounds a double-precision floating-point value to the nearest integral value closest to the specified accuracy.

public static double RoundOff(this double value, RoundOffAccuracy accuracy)

Parameters

value Double

A double-precision floating-point number to be rounded.

accuracy RoundOffAccuracy

The accuracy to use in the rounding.

Returns

Double

The integer value closest to the specified accuracy of value.
Note that this method returns a Double instead of an integral type.

ToTimeSpan(Double, TimeUnit)

Converts the specified value to its equivalent TimeSpan representation.

public static TimeSpan ToTimeSpan(this double value, TimeUnit timeUnit)

Parameters

value Double

The value to be converted.

timeUnit TimeUnit

One of the enumeration values that specifies the outcome of the conversion.

Returns

TimeSpan

A TimeSpan that corresponds to value from timeUnit.

Exceptions

OverflowException

The value paired with timeUnit is outside its valid range.

ArgumentOutOfRangeException

timeUnit was outside its valid range.