NIP with unexpected 6dp value

We have a NIP publish live updates to TREP, any idea what is the problem?
When we do publish from RFA C++ via NIP with 2dp and it publish unexpected 6dp value
small program create a publisher, Publishes UPLIMIT=0, then UPLIMIT=2109.45 and finally UPLIMIT=2109.45 with precision hint as 2. All these values directly hard coded in the code. why we got unexpected 6dp
UPLIMIT : REAL 2 : [0.000000]
UPLIMIT : REAL 5 : [2109.449999]
UPLIMIT : REAL 4 : [2109.44]
Best Answer
-
I think it could be a limitation when multiplying double and integer, as mentioned in this thread.
For example, the following code prints 2109449999, not 2109450000.
Int64 x = 2109.45 * 1000000;
printf("#### %lld \n", x); //2109449999You can try the solution (llround) mentioned in that thread.
Int64 x = llround(2109.45 * 1000000);
printf("#### %lld \n", x); //21094500000
Answers
-
Please share the code snippet you use to encode the above fields.
Also, enable IPCTrace in RFA and share the trace file - so we can see what is happening at the wire level - as described in Activate full message logs for RSSL connections in RFA C++ - Forum | Refinitiv Developer Community
The example above is for a standard Consumer RSSL connection - you will need to apply similar changes for the RSSL_NIPROV connection being used by your NIP.
Also, if you are writing a new NIP from scratch or upgrading an existing NIP application, I strongly recommend you use Enterprise Message API - which is part of our strategic RT-SDK - and is much easier to learn and code in than RFA.
RFA is a feature-complete/legacy API with no new features etc to be supported in the future - other than basic maintenance releases.
0 -
It appears that some of the value will be correct, and some will be wrong when we set the precisionHint to various values.
For instance
Double value 2109.45
precision 6
<FS>316<US>XX<GS>ASOK.BO<US><RS>
UPLIMIT : REAL 11 : [2109.449999]
precision 7
<FS>316<US>XX<GS>ASOK.BO<US><RS>
UPLIMIT : REAL 12 : [2109.4500000]
precision 8
<FS>316<US>XX<GS>ASOK.BO<US><RS>
UPLIMIT : REAL 13 : [2109.44999999]
precision 9
<FS>316<US>XX<GS>ASOK.BO<US><RS>
UPLIMIT : REAL 14 : [2109.449999999]
Double value 103.07
precision 6
<FS>316<US>XX<GS>ASOK.BO<US><RS>
UPLIMIT : REAL 10 : [103.070000]
precision 7
UPLIMIT : REAL 11 : [103.0699999]
precision 8
<FS>316<US>XX<GS>ASOK.BO<US><RS>
UPLIMIT : REAL 12 : [103.07000000]
precision 9
<FS>316<US>XX<GS>ASOK.BO<US><RS>
UPLIMIT : REAL 13 : [103.070000000]
Here is the code which calls RFA to publish the data
void RFAPubMessage::setDoubleValue(double dValue, IMDFieldDescriptor* fDesc, unsigned int precisionHint)
{
m_dataBuffer.clear();
RFAFieldDescriptor* rfaDesc = reinterpret_cast<RFAFieldDescriptor*>(fDesc);
switch (rfaDesc->fDef()->getOMMType())
{
case rfa::data::DataBuffer::Real32Enum:
case rfa::data::DataBuffer::Real64Enum:
{
rfa::data::Real64 realValue;
if ((rfa::common::UInt8)precisionHint > rfa::data::Exponent0){
precisionHint = (unsigned int)rfa::data::Exponent0;
}
realValue.setValue((rfa::common::Int64)(dValue * s_nDecimalMap[precisionHint]));
realValue.setMagnitudeType(rfa::data::Exponent0 - (rfa::common::UInt8)precisionHint);
m_dataBuffer.setReal(realValue);
break;
}
case rfa::data::DataBuffer::DoubleEnum:
m_dataBuffer.setDouble(dValue);
break;
case rfa::data::DataBuffer::FloatEnum:
m_dataBuffer.setFloat((rfa::common::Float)dValue);
break;
default:
throw MDETException (MD_INVALID_DATA_TYPE, "Data type mismatch!");
}
m_fieldEntry.clear();
m_fieldEntry.setFieldID((rfa::common::Int16)fDesc->getFieldId());
m_fieldEntry.setData(m_dataBuffer);
m_fieldListIterator.bind(m_fieldEntry);
}
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 685 Datastream
- 1.4K DSS
- 616 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 252 ETA
- 557 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 653 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 229 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛