C# Class NExtends.Primitives.DoubleExtensions

Afficher le fichier Open project: LuccaSA/NExtends

Méthodes publiques

Méthode Description
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

Method Details

Ceiling() public static méthode

public static Ceiling ( this d, int precision ) : Double
d this
precision int
Résultat Double

Floor() public static méthode

public static Floor ( this d, int precision ) : Double
d this
precision int
Résultat Double

RealRound() public static méthode

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
Résultat Double

Round() public static méthode

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
Résultat Double

ToJSON() public static méthode

public static ToJSON ( this d ) : String
d this
Résultat String

tronquerDecimales() public static méthode

public static tronquerDecimales ( this value ) : double
value this
Résultat double