C# Класс NExtends.Primitives.DoubleExtensions

Показать файл Открыть проект

Открытые методы

Метод Описание
Ceiling ( this d, int precision ) : Double
Floor ( this d, int precision ) : Double
RealRound ( this d, int precision ) : Double

Round number to given precision using mode MidpointRounding.AwayFromZero

ie: the normal maths rounding

For example: RealRound(0.165, 2) returns 0.17 and NOT 0.16

Round ( this d, int precision ) : Double

Round number to given precision using mode MidpointRounding.ToEven

If the one's digit is odd, it is changed to an even digit. Otherwise, it is left unchanged. This behavior follows IEEE Standard 754, section 4. It is sometimes called rounding to nearest, or banker's rounding. It minimizes rounding errors that result from consistently rounding a midpoint value in a single direction.

For example: Round(0.165, 2) returns 0.16 and NOT 0.17

More info on http://stackoverflow.com/questions/977796/in-c-math-round2-5-result-is-2-instead-of-3-are-you-kidding-me

ToJSON ( this d ) : String
tronquerDecimales ( this value ) : double

Описание методов

Ceiling() публичный статический Метод

public static Ceiling ( this d, int precision ) : Double
d this
precision int
Результат Double

Floor() публичный статический Метод

public static Floor ( this d, int precision ) : Double
d this
precision int
Результат Double

RealRound() публичный статический Метод

Round number to given precision using mode MidpointRounding.AwayFromZero

ie: the normal maths rounding

For example: RealRound(0.165, 2) returns 0.17 and NOT 0.16

public static RealRound ( this d, int precision ) : Double
d this
precision int
Результат Double

Round() публичный статический Метод

Round number to given precision using mode MidpointRounding.ToEven

If the one's digit is odd, it is changed to an even digit. Otherwise, it is left unchanged. This behavior follows IEEE Standard 754, section 4. It is sometimes called rounding to nearest, or banker's rounding. It minimizes rounding errors that result from consistently rounding a midpoint value in a single direction.

For example: Round(0.165, 2) returns 0.16 and NOT 0.17

More info on http://stackoverflow.com/questions/977796/in-c-math-round2-5-result-is-2-instead-of-3-are-you-kidding-me

public static Round ( this d, int precision ) : Double
d this
precision int
Результат Double

ToJSON() публичный статический Метод

public static ToJSON ( this d ) : String
d this
Результат String

tronquerDecimales() публичный статический Метод

public static tronquerDecimales ( this value ) : double
value this
Результат double