Decimal Field Instruction having single field operator

Imported from previous forum

Hi all,

I am developing FIX-FAST message receiver.
I want some clarification regarding Decimal Field Instruction having single field operator.

In template, we have decimal instruction with single field operator:
[Please read “(“ as “<” and “)” as “>”]

(decimal id=“1” presence=“optional” name=“Price”)
(copy/)
(/decimal)

As an example, Sender want to send Price in a sequence as 9427.55 and NULL
Because Decimal is having single field operator, it needs only one PMAP bit.

Sequence 1: (Sender want to send 9427.55)
PMAP Bit will be '1’
Encoded value will be in form of exponent and mantissa:
Exponent as “-2” and Mantissa as “942755”.
Wire representation for complete decimal field will be:
0xFE 0x39 0x45 0xA3

0xFE will represent exponent (as "-2") 
and 0x39 0x45 0xA3 will represent mantissa (as "942755")

Sequence 2: (Sender want to send NULL)
PMAP Bit will be '1’
Encoded value will have only one field as NULL.
Wire representation will be 0x80.

or two separate fields as 0x80 0x80. 
First one for exponent and second one for mantissa???
I am not clear. I think only one 0x80 will be correct.

Whether my understanding about “Decimal having single field operator” is correct?
Please feedback.

Thanks & regards
Shashank

Hi Shashank,

You asked:

In template, we have decimal instruction with single field operator:
[Please read “(“ as “<” and “)” as “>”]

(decimal id=“1” presence=“optional” name=“Price”) (copy/) (/decimal)

Whether my understanding about “Decimal having single field operator” is
correct? Please feedback.

You are correct. Only one PMAP bit is used in this case.

If pmap == 0 then the previous values of both the exponent and mantissa are used.
if pmap == 1 and the exponent is null then the optional field does not exist in the decoded message.
if pmap == 1 and the exponent is not null, then the mantissa should be present – mantissa is NOT a nullable value.


One case where two presence bits are used is:

(decimal presence=“mandatory”)
(exponent)
(default/)
(/exponent)
(mantissa)
(copy/)
(/mantissa)
(decimal)

If I changed the above example to have presence=“optional” then the number of PMAP bits would change dynamically depending on whether the exponent was nullable.

Dale Wilson

Principal Software Engineer
Author of the QuickFAST open source implementation of FAST
http://www.quickfast.org

Hi Dale,

Thanks for reply.

I want some clarification, still I am not clear.

According to spec ~
"6.2.2 Decimal Field Instructions: If the decimal field has optional presence and has INDIVIDUAL OPERATORS,
the presence of the mantissa is dependent on the presence of the exponent.“
and
"10.5.1 Presence Map and NULL Utilization:
Decimal fields with individual operators have the following utilization:
• If the decimal has mandatory presence, the exponent and mantissa fields are treated as two separate
mandatory integer fields as described above.
• If the decimal has optional presence, the exponent field is treated as an optional integer
field and the mantissa field is treated as a mandatory integer field. The presence of the mantissa field and
any related bits in the presence map are dependent on the presence of the exponent.
The mantissa field appears in the stream iff the exponent value is considered present.
If the mantissa has an operator that requires a bit in the presence map, this bit is
present iff the exponent value is considered present.”

I am some what clear with “Decimal fields with individual operators”

According to my given example:

(decimal id=“1” presence=“optional” name=“Price”)
(copy/)
(/decimal)

I have a single field operator for decimal field instruction.

For “Decimal field with single field operator”, my understanding is:

  1. Both Exponent and mantissa will be treated as “optional” field.
    (Am I right? Or always Mantissa will be treated as Mandatory.
    According to spec, mantissa field is treated as a mandatory integer field, if Decimal
    is having individual operators and presence of decimal is optional)

  2. The presence of the mantissa does not depend on the presence of the exponent. (As there is no
    individual field operator). Am I right here?

So, in case of “Decimal with single field operator”,

Sequence 1: (Sender want to send 9427.55)
PMAP Bit will be '1’
Encoded value will be in form of exponent and mantissa:
Sender will send Exponent as “-2” and Mantissa as “942755”.
Receiver will expect two fields (Exponent and Mantissa) in FAST Format.
Here presence of Mantissa does not depend on presence of exponent (as single field operator)
Wire representation for complete decimal field will be:
0xFE 0x39 0x45 0xA3

Sequence 2: (Sender want to send NULL)
PMAP Bit will be '1’
The combined decoded decimal value should be “NULL”.
Here presence of Mantissa does not depend on presence of exponent (as single field operator)
Receiver will expect two fields (Exponent and Mantissa) in FAST Format.
whether Sender will send only one NULL (0x80) for exponent;
or two NULL (0x80 0x80) for exponent and mantissa???

Thanks & regards
Shashank

According to spec ~ “6.2.2 Decimal Field Instructions: If the decimal
field has optional presence and has INDIVIDUAL OPERATORS, the presence
of the mantissa is dependent on the presence of the exponent.” and
“10.5.1 Presence Map and NULL Utilization: Decimal fields with
individual operators have the following utilization: • If the decimal
has mandatory presence, the exponent and mantissa fields are treated as
two separate mandatory integer fields as described above. • If the
decimal has optional presence, the exponent field is treated as an
optional integer field and the mantissa field is treated as a mandatory
integer field. The presence of the mantissa field and any related bits
in the presence map are dependent on the presence of the exponent. The
mantissa field appears in the stream iff the exponent value is
considered present. If the mantissa has an operator that requires a bit
in the presence map, this bit is present iff the exponent value is
considered present.”

I am some what clear with “Decimal fields with individual operators”

All of the above does not apply to your example because you do not have individual examples.

According to my given example:

(decimal id=“1” presence=“optional” name=“Price”) (copy/) (/decimal)

I have a single field operator for decimal field instruction.

In this case the PMAP bit and the presence attribute are used to decode the exponent. If it turns out the exponent exists and is not null, the the mantissa is mandatory and not nullable.

I can’t find a place in the standard where this is made explicit, but it is inherent in the description of decimal numbers.

Section 10.5.1 may help:
The default, copy, and increment operators have the following presence map and NULL utilization:
• Mandatory integer, decimal, string and byte vector fields – one bit. If set, the value appears in the stream.
• Optional integer, decimal, string and byte vector fields – one bit. If set, the value appears in the stream in a nullable representation. A NULL indicates that the value is absent and the state of the previous value is set to empty, except when the default operator is used in which case the state of the previous value is left unchanged.

Decimal in this case refers to a decimal without individual operators for exponent and mantissa.

For “Decimal field with single field operator”, my understanding is:

  1. Both Exponent and mantissa will be treated as “optional” field.
    (Am I right?

No, the mantissa “inherits” it’s presence from the exponent.

Or always Mantissa will be treated as Mandatory.

According to spec, mantissa field is treated as a mandatory
integer field, if Decimal is having individual operators and
presence of decimal is optional)

For your example, we do NOT have individual operators.

  1. The presence of the mantissa does not depend on the presence of the
    exponent. (As there is no individual field operator). Am I right here?

Yes.

So, in case of “Decimal with single field operator”,

Sequence 1: (Sender want to send 9427.55) PMAP Bit will be ‘1’ Encoded
value will be in form of exponent and mantissa: Sender will send
Exponent as “-2” and Mantissa as “942755”. Receiver will expect two
fields (Exponent and Mantissa) in FAST Format.

OK

Here presence of Mantissa

does not depend on presence of exponent (as single field operator)

Yes it does. If the Exponent is present, the mantissa will be too, if the exponent is not present the mantissa will not be.

Wire

representation for complete decimal field will be: 0xFE 0x39 0x45 0xA3

Sequence 2: (Sender want to send NULL) PMAP Bit will be ‘1’ The combined
decoded decimal value should be “NULL”.

Yes.

Here presence of Mantissa does

not depend on presence of exponent (as single field operator) Receiver
will expect two fields (Exponent and Mantissa) in FAST Format.

No. Once the receiver sees the null Exponent it knows that the Mantissa field will not appear.

whether

Sender will send only one NULL (0x80) for exponent; or two NULL (0x80
0x80) for exponent and mantissa???

One NULL indicates the entire Decimal field is NULL (because the field does not have individual operators.)

Hope this helps,

Dale

Shashank,

the mantissa is not present if the exponent is NULL.

(Section 10.6.2: “If a scaled number is nullable, the exponent is nullable and the mantissa is non-nullable. A NULL scaled number is represented as a NULL exponent. The mantissa is present in the stream iff the exponent is not NULL.”)

Best,
Rolf

Hi Dale,

Thanks for reply.

I want some clarification, still I am not clear.

According to spec ~ “6.2.2 Decimal Field Instructions: If the decimal
field has optional presence and has INDIVIDUAL OPERATORS, the presence
of the mantissa is dependent on the presence of the exponent.” and
“10.5.1 Presence Map and NULL Utilization: Decimal fields with
individual operators have the following utilization: • If the decimal
has mandatory presence, the exponent and mantissa fields are treated as
two separate mandatory integer fields as described above. • If the
decimal has optional presence, the exponent field is treated as an
optional integer field and the mantissa field is treated as a mandatory
integer field. The presence of the mantissa field and any related bits
in the presence map are dependent on the presence of the exponent. The
mantissa field appears in the stream iff the exponent value is
considered present. If the mantissa has an operator that requires a bit
in the presence map, this bit is present iff the exponent value is
considered present.”

I am some what clear with “Decimal fields with individual operators”

According to my given example:

(decimal id=“1” presence=“optional” name=“Price”) (copy/) (/decimal)

I have a single field operator for decimal field instruction.

For “Decimal field with single field operator”, my understanding is:

  1. Both Exponent and mantissa will be treated as “optional” field.
    (Am I right? Or always Mantissa will be treated as Mandatory.
    According to spec, mantissa field is treated as a mandatory
    integer field, if Decimal is having individual operators and
    presence of decimal is optional)

  2. The presence of the mantissa does not depend on the presence of the
    exponent. (As there is no individual field operator). Am I right here?

So, in case of “Decimal with single field operator”,

Sequence 1: (Sender want to send 9427.55) PMAP Bit will be ‘1’ Encoded
value will be in form of exponent and mantissa: Sender will send
Exponent as “-2” and Mantissa as “942755”. Receiver will expect two
fields (Exponent and Mantissa) in FAST Format. Here presence of Mantissa
does not depend on presence of exponent (as single field operator) Wire
representation for complete decimal field will be: 0xFE 0x39 0x45 0xA3

Sequence 2: (Sender want to send NULL) PMAP Bit will be ‘1’ The combined
decoded decimal value should be “NULL”. Here presence of Mantissa does
not depend on presence of exponent (as single field operator) Receiver
will expect two fields (Exponent and Mantissa) in FAST Format. whether
Sender will send only one NULL (0x80) for exponent; or two NULL (0x80
0x80) for exponent and mantissa???

Thanks & regards Shashank

Hi Dale, Rolf

Thanks for reply. Now it is clear to me.