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 Scale and Valuefields in bytes.If the length is less than or equal to 2 then the Decimalis an invalid value that cannot be used.

Scale

Int16

A signed integer representing scale which is the inverse power of ten that is applied to the unscaled value.

i.e., the decimal number of the value multiplied by 10-scale

The integer is encoded starting with the least significant bit.

Value

OctetString

A 2-complement signed integer representing the unscaled value.

The number of bytes is the value of the Length field minus size of the Scalefield.

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. Note that a Decimalis like a built-in type and a DevelopmentPlatform has to have hardcoded knowledge of the type. No Structuremetadata is published for this type.

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.