C# Class Redzen.Structures.Compact.FixedPointDecimal

A fixed point decimal data type that has the following qualities: 1) Uses a Int32 to hold the value (4 bytes versus the native decimal's 16 bytes). 2) Defines a fixed number of six digits after the decimal place. 3) Allows a null value to be represented, requiring a single bit to allocated for this. The range of FixedPointDecimal is -1,073.741823 to 1,073.741823. This can therefore represent all possible values in the SQL data type decimal(9,6). The range takes into into account the null bit and the fixed four digits after the decimal place. Fixed point maths also has the benefit of allowing for far simpler/faster comparison.
Afficher le fichier Open project: colgreen/Redzen Class Usage Examples

Méthodes publiques

Свойство Type Description
Null FixedPointDecimal

Méthodes publiques

Méthode Description
Compare ( FixedPointDecimal d1, FixedPointDecimal d2 ) : int

Compares two specified FixedPointDecimal values.

Create ( decimal d ) : FixedPointDecimal

Static factory method to create a FixedDecimal.

Equals ( FixedPointDecimal d1, FixedPointDecimal d2 ) : bool

Determines whether the specified FixedPointDecimal is equal to the current FixedPointDecimal.

Equals ( object value ) : bool

Determines whether the specified Object is equal to the current Object.

FixedPointDecimal ( decimal val ) : System

Construct FixedPointDecimal from the provided nullable decimal.

GetHashCode ( ) : int

Gets the hash code for the object.

TryParse ( string s, FixedPointDecimal &result ) : bool

Converts the string representation of a number to its FixedPointDecimal equivalent. A return value indicates whether the conversion succeeded or failed.

TryParseTruncate ( string s, FixedPointDecimal &result ) : bool

Converts the string representation of a number to its FixedPointDecimal equivalent. A return value indicates whether the conversion succeeded or failed. Values outside the range of a FixedPointDecimal are truncated to the min or max values for FixedPointDecimal as appropriate. Input values with more than four decimal places have their precision truncated to to four decimal places.

operator ( ) : bool

Determines if two FixedPointDecimal objects are not equal.

Private Methods

Méthode Description
FixedPointDecimal ( uint significand, bool isNegative ) : System
InternalTryParse ( string s, FixedPointDecimal &result, bool truncateRange ) : bool

Method Details

Compare() public static méthode

Compares two specified FixedPointDecimal values.
public static Compare ( FixedPointDecimal d1, FixedPointDecimal d2 ) : int
d1 FixedPointDecimal The first to compare.
d2 FixedPointDecimal The second to compare.
Résultat int

Create() public static méthode

Static factory method to create a FixedDecimal.
public static Create ( decimal d ) : FixedPointDecimal
d decimal The value to create the object from.
Résultat FixedPointDecimal

Equals() public static méthode

Determines whether the specified FixedPointDecimal is equal to the current FixedPointDecimal.
public static Equals ( FixedPointDecimal d1, FixedPointDecimal d2 ) : bool
d1 FixedPointDecimal The first to compare.
d2 FixedPointDecimal The second to compare.
Résultat bool

Equals() public méthode

Determines whether the specified Object is equal to the current Object.
public Equals ( object value ) : bool
value object The object to compare with the current object.
Résultat bool

FixedPointDecimal() public méthode

Construct FixedPointDecimal from the provided nullable decimal.
public FixedPointDecimal ( decimal val ) : System
val decimal The value to convert.
Résultat System

GetHashCode() public méthode

Gets the hash code for the object.
public GetHashCode ( ) : int
Résultat int

TryParse() public static méthode

Converts the string representation of a number to its FixedPointDecimal equivalent. A return value indicates whether the conversion succeeded or failed.
public static TryParse ( string s, FixedPointDecimal &result ) : bool
s string The value to parse.
result FixedPointDecimal Upon success contains the equivalent of the value of .
Résultat bool

TryParseTruncate() public static méthode

Converts the string representation of a number to its FixedPointDecimal equivalent. A return value indicates whether the conversion succeeded or failed. Values outside the range of a FixedPointDecimal are truncated to the min or max values for FixedPointDecimal as appropriate. Input values with more than four decimal places have their precision truncated to to four decimal places.
public static TryParseTruncate ( string s, FixedPointDecimal &result ) : bool
s string The value to parse.
result FixedPointDecimal Upon success contains the equivalent of the value of .
Résultat bool

operator() public static méthode

Determines if two FixedPointDecimal objects are not equal.
public static operator ( ) : bool
Résultat bool

Property Details

Null public_oe static_oe property

Public static instance of a null FixedPointDecimal.
public static FixedPointDecimal,Redzen.Structures.Compact Null
Résultat FixedPointDecimal