Share via


Decimal Structure

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Represents a decimal number.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Structure Decimal
public struct Decimal
public value class Decimal
[<Sealed>]
type Decimal =  struct end
JScript supports the use of structures, but not the declaration of new ones.

The Decimal type exposes the following members.

Constructors

  Name Description
Public method Decimal(Double) Initializes a new instance of Decimal to the value of the specified double-precision floating-point number.
Public method Decimal(Int32) Initializes a new instance of Decimal to the value of the specified 32-bit signed integer.
Public method Decimal(array<Int32> [] () [] []) Initializes a new instance of Decimal to a decimal value represented in binary and contained in a specified array.
Public method Decimal(Int64) Initializes a new instance of Decimal to the value of the specified 64-bit signed integer.
Public method Decimal(Single) Initializes a new instance of Decimal to the value of the specified single-precision floating-point number.
Public method Decimal(UInt32) Initializes a new instance of Decimal to the value of the specified 32-bit unsigned integer.
Public method Decimal(UInt64) Initializes a new instance of Decimal to the value of the specified 64-bit unsigned integer.
Public method Decimal(Int32, Int32, Int32, Boolean, Byte) Initializes a new instance of Decimal from parameters specifying the instance's constituent parts.

Top

Methods

  Name Description
Public method Equals Indicates whether this instance and a specified object are equal. (Inherited from ValueType.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

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. The Decimal type does not eliminate the need for rounding. Rather, it minimizes errors due to rounding.

A decimal number is a floating-point value that consists of a sign, a numeric value where each digit in the value ranges from 0 to 9, and a scaling factor that indicates the position of a floating decimal point that separates the integral and fractional parts of the numeric value.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System Namespace