Optional Decimal Logic

Imported from previous forum

All,

I’m have a bit of an issue understanding the correct logic concerning Optional Decimals with inidividual operators. Could someone reply to the correctness of the 2 cases below?

Thanks,
Mike

  1. Mandatory Decimal with Individual operators:
    Presence: Exponent -> Mandatory, Mantissa -> Mandatory
    Operator: Exponent -> Default(0), Mantissa -> Delta
    Logic:

    Decode_u32( Exponent ); // Bit Required
    Decode_u32( Mantissa ); // No Bit Required

  2. Optional Decimal with Individual operators:
    Presence: Exponent -> Optional, Mantissa -> Mandatory (IFF Exponent is present in stream)

    ExponentPresentInStream = Decode_u32( exponent )// Bit Required for Exponent
    if( ExponentPresentInSteam )
    Decode_u32( Mantissa ); // No Bit Required

Mike,

example 1 is correct but example 2 is unclear.

The way you indicate an absent (from an application perspective) optional decimal field is to use a NULL exponent.

(Please refer to section 10.6.2)

/Rolf

All,

I’m have a bit of an issue understanding the correct logic concerning
Optional Decimals with inidividual operators. Could someone reply to the
correctness of the 2 cases below?

Thanks, Mike

  1. Mandatory Decimal with Individual operators: Presence: Exponent →
    Mandatory, Mantissa → Mandatory Operator: Exponent → Default(0),
    Mantissa → Delta Logic:

     Decode_u32( Exponent ); // Bit Required Decode_u32( Mantissa );
     // No Bit Required
    
  2. Optional Decimal with Individual operators: Presence: Exponent →
    Optional, Mantissa → Mandatory (IFF Exponent is present in stream)

     ExponentPresentInStream = Decode_u32( exponent )// Bit Required
     for Exponent if( ExponentPresentInSteam ) Decode_u32( Mantissa
     ); // No Bit Required
    

Rolf,

My question in example 2 is basically: Do you NOT continue processing the mantissa if after the result of processing the exponent, the exponent’s current value in the dicationary is set to EMPTY. (either from previous value or NULL encoding)?

Thanks again,
Mike

Mike,

example 1 is correct but example 2 is unclear.

The way you indicate an absent (from an application perspective)
optional decimal field is to use a NULL exponent.

(Please refer to section 10.6.2)

/Rolf

All,

I’m have a bit of an issue understanding the correct logic concerning
Optional Decimals with inidividual operators. Could someone reply to
the correctness of the 2 cases below?

Thanks, Mike

  1. Mandatory Decimal with Individual operators: Presence: Exponent →
    Mandatory, Mantissa → Mandatory Operator: Exponent → Default(0),
    Mantissa → Delta Logic:

     Decode_u32( Exponent ); // Bit Required Decode_u32( Mantissa
     ); // No Bit Required
    
  2. Optional Decimal with Individual operators: Presence: Exponent →
    Optional, Mantissa → Mandatory (IFF Exponent is present in stream)

     ExponentPresentInStream = Decode_u32( exponent )// Bit
     Required for Exponent if( ExponentPresentInSteam ) Decode_u32(
     Mantissa ); // No Bit Required
    

Mike,

you don’t process a mantissa field if the exponent value 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.”

(This includes any pmap bit that would be present in the pmap as a result of an operator defined for the mantissa part. i.e., the pmap bit will be absent as well in the case of a null exponent. This is the only time you have a varying number of pmap bits for a field.)

/Rolf

Rolf,

My question in example 2 is basically: Do you NOT continue processing
the mantissa if after the result of processing the exponent, the
exponent’s current value in the dicationary is set to EMPTY. (either
from previous value or NULL encoding)?

Thanks again, Mike