asp.net.ph

Decimal Structure

System Namespace


Represents a decimal number.

Decimal Class Members

Collapse   Constructors

Visibility Constructor Parameters
public Decimal ( Int32 value )
public Decimal ( UInt32 value )
public Decimal ( Int64 value )
public Decimal ( UInt64 value )
public Decimal ( Single value )
public Decimal ( Double value )
public Decimal ( Int32 bits )
public Decimal ( Int32 lo , Int32 mid , Int32 hi , Boolean isNegative , Byte scale )

Collapse   Fields

Visibility Name Type
public static MaxValue Decimal
public static MinusOne Decimal
public static MinValue Decimal
public static One Decimal
public static Zero Decimal

Collapse   Methods

Visibility Name Parameters Return Type
public static Add ( Decimal d1 , Decimal d2 ) Decimal
public static Ceiling ( Decimal d ) Decimal
public static Compare ( Decimal d1 , Decimal d2 ) Int32
public CompareTo ( Decimal value ) Int32
public CompareTo ( Object value ) Int32
public static Divide ( Decimal d1 , Decimal d2 ) Decimal
public Equals ( Object value ) Boolean
public Equals ( Decimal value ) Boolean
public static Equals ( Decimal d1 , Decimal d2 ) Boolean
public static Floor ( Decimal d ) Decimal
public static FromOACurrency ( Int64 cy ) Decimal
public static GetBits ( Decimal d ) Int32
public GetHashCode ( ) Int32
public GetTypeCode ( ) TypeCode
public static Multiply ( Decimal d1 , Decimal d2 ) Decimal
public static Negate ( Decimal d ) Decimal
public static Parse ( String s , IFormatProvider provider ) Decimal
public static Parse ( String s , NumberStyles style , IFormatProvider provider ) Decimal
public static Parse ( String s ) Decimal
public static Parse ( String s , NumberStyles style ) Decimal
public static Remainder ( Decimal d1 , Decimal d2 ) Decimal
public static Round ( Decimal d , Int32 decimals ) Decimal
public static Round ( Decimal d ) Decimal
public static Round ( Decimal d , MidpointRounding mode ) Decimal
public static Round ( Decimal d , Int32 decimals , MidpointRounding mode ) Decimal
public static Subtract ( Decimal d1 , Decimal d2 ) Decimal
public static ToByte ( Decimal value ) Byte
public static ToDouble ( Decimal d ) Double
public static ToInt16 ( Decimal value ) Int16
public static ToInt32 ( Decimal d ) Int32
public static ToInt64 ( Decimal d ) Int64
public static ToOACurrency ( Decimal value ) Int64
public static ToSByte ( Decimal value ) SByte
public static ToSingle ( Decimal d ) Single
public ToString ( String format ) String
public ToString ( IFormatProvider provider ) String
public ToString ( ) String
public ToString ( String format , IFormatProvider provider ) String
public static ToUInt16 ( Decimal value ) UInt16
public static ToUInt32 ( Decimal d ) UInt32
public static ToUInt64 ( Decimal d ) UInt64
public static Truncate ( Decimal d ) Decimal
public static TryParse ( String s , Decimal& result ) Boolean
public static TryParse ( String s , NumberStyles style , IFormatProvider provider , Decimal& result ) Boolean

Remarks

The Decimal value type represents decimal numbers ranging from positive 79,228,162,514,264,337,593,543,950,335 to negative 79,228,162,514,264,337,593,543,950,335. The Decimal value type is appropriate for financial calculations requiring large numbers of significant integral and fractional digits and no round-off errors.

A decimal number is a signed, fixed-point value consisting of an integral part and an optional fractional part. The integral and fractional parts consist of a series of digits that range from zero to nine ( 0 to 9 ), separated by a decimal point symbol.

The binary representation of an instance of Decimal consists of a 1-bit sign, a 96-bit integer number, and a scaling factor used to divide the 96-bit integer and specify what portion of it is a decimal fraction. The scaling factor is implicitly the number 10, raised to an exponent ranging from 0 to 28.

Therefore, the binary representation of a Decimal value is of the form, ( ( -296 to 2 96 ) / 10 ( 0 to 28 ) ), where -2 96 is equal to MinValue, and 296 is equal to MaxValue.

This type provides methods that convert Decimal values to and from type Char, SByte, Int16, Int32, Int64, Byte, UInt16, UInt32, and UInt64. Conversions from other types to Decimal are widening conversions that never lose information or throw exceptions.

Conversions from Decimal to other types are narrowing conversions that round the Decimal value to the nearest integer value towards zero. If the result of the conversion is not representable in the destination type, an OverflowException is thrown.

This type provides methods that convert Decimal values to and from Single and Double. Conversions from Decimal to Single or Double are narrowing conversions that may lose precision but not information about the magnitude of the converted value. The conversion will not throw an exception.

Conversions from Single or Double to Decimal throw an OverflowException if the result of the conversion is not representable as a Decimal.

This type implements interfaces IComparable, IFormattable, and IConvertible. Use the Convert class for conversions instead of this type's explicit interface member implementation of IConvertible.

See Also

SByte   Int16   Int32   Int64   Byte   UInt16   UInt32   UInt64   Single   Double   Char Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph