Send feedback on this topic.
Teradata.Client.Provider
TdDecimal Constructor(Int32,Int32,Int32,Int32,Byte,Byte)
Example 



Teradata.Client.Provider Namespace > TdDecimal Structure > TdDecimal Constructor : TdDecimal Constructor(Int32,Int32,Int32,Int32,Byte,Byte)
Low number component. The 0-31 bits of the internal representation
Middle-low number component. The 32-63 bits of the internal representation
Middle-high number component. The 64-95 bits of the internal representation
His number component. The 96-127 bits of the internal representation
The precision of the TdDecimal
The scale of the TdDecimal
Initializes a new instance of TdDecimal from parameters specifying the instance's constituent parts.
Syntax
'Declaration
 
Public Function New( _
   ByVal data1 As Integer, _
   ByVal data2 As Integer, _
   ByVal data3 As Integer, _
   ByVal data4 As Integer, _
   ByVal precision As Byte, _
   ByVal scale As Byte _
)
'Usage
 
Dim data1 As Integer
Dim data2 As Integer
Dim data3 As Integer
Dim data4 As Integer
Dim precision As Byte
Dim scale As Byte
 
Dim instance As New TdDecimal(data1, data2, data3, data4, precision, scale)
public TdDecimal( 
   int data1,
   int data2,
   int data3,
   int data4,
   byte precision,
   byte scale
)
public:
TdDecimal( 
   int data1,
   int data2,
   int data3,
   int data4,
   byte precision,
   byte scale
)

Parameters

data1
Low number component. The 0-31 bits of the internal representation
data2
Middle-low number component. The 32-63 bits of the internal representation
data3
Middle-high number component. The 64-95 bits of the internal representation
data4
His number component. The 96-127 bits of the internal representation
precision
The precision of the TdDecimal
scale
The scale of the TdDecimal
Remarks

TdDecimal uses four 32 bit integers to internally store the number. The four integers will represent the decimal as a scaled 128 bit integer --the decimal point has been removed by multiplying the number by 10 to the power of the scale. This decimal is stored this way because it is very easy to perform operation on the decimal. The precision and scale are stored separately within TdDecimal.

The four number components that are passed in consist of the following:

Example

The following is an example of setting up the number components, and then invoking the constructor.

// Decimal Number:  82985000914920.733988
// Hex Representation:      4 7FA5F2A8 A350FD24
TdDecimal value01 = new TdDecimal(unchecked((Int32)0xA350FD24), (Int32)0x7FA5F2A8, (Int32)0x00000004, 0, 20, 6);
            
// Decimal Number:      -4352.68
// Hex Representation:  ffffffff ffffffff ffffffff fff95bbc (represented in two's compliment form)
TdDecimal value02 = new TdDecimal(
                            unchecked((Int32)0xfff95bbc), 
                            unchecked((Int32)0xffffffff, 
                            unchecked((Int32)0xffffffff, 
                            unchecked((Int32)0xffffffff, 
                            6, 2);
Requirements

Target Platforms: Windows 8.1, Windows 10, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019

See Also

Reference

TdDecimal Structure
TdDecimal Members
Overload List