A Decimal is a high-precision signed decimal number. It consists of an arbitrary precision integer unscaled value and an integer scale. The scale is the power of ten that is applied to the unscaled value.

A Decimalhas the fields described in Table 3.

Table 3– Layout of Decimal

Field

Type

Description

TypeId

NodeId

The identifier for the Decimal DataType.

Encoding

Byte

This value is always 1.

Length

Int32

The length of the Decimal.If the length is less than or equal to 0 then the Decimalvalue is 0.

Scale

Int16

A signed integer representing the power of ten used to scale the value.

i.e. the decimal number of the value * 10-scale

The integer is encoded starting with the least significant bit.

Value

Byte [*]

A 2-complement signed integer representing the unscaled value.

The number of bits is inferred from the length of the length field.

If the number of bits is 0 then the value is 0.

The integer is encoded with the least significant byte first.

When a Decimalis encoded in a Variantthe built-in type is set to ExtensionObject. Decoders that do not understand the Decimaltype shall treat it like any other unknown Structureand pass it on to the application. Decoders that do understand the Decimalcan parse the value and use any construct that is suitable for the DevelopmentPlatform.

If a Decimalis embedded in another Structurethen the DataTypeDefinitionfor the field shall specify the NodeIdof the Decimal Nodeas the DataType. If a Serverpublishes an OPC Binary type description for the Structurethen the type description shall set the DataTypefor the field to ExtensionObject.