Get double as integer

For example I have Real32 DataBuffer. If I call getInt64,what will happen? Truncate or error?
If a Real64/Double DataBuffer, I also call getInt64(). What will happen?
Best Answer
-
I checked and found that DataBuffer::getDouble() works with Real and Double. Otherwise, you will get the following exception.
Invalid DataBuffer type [4] in DataBuffer::getDouble(). Only RealEnum or DoubleEnum types are allowed.
I can call getInt() for Real but I only get the integer part.
case DataBuffer::RealEnum:
_out->out("\n GetInt for Real: %lld\n", dataBuffer.getInt());
_out->out("\n GetDouble for Real: %f\n", dataBuffer.getDouble());
printf("\nGetAsString(): %s\n", dataBuffer.getAsString().c_str());
break;
GetInt for Real: 3
GetDouble for Real: 3.720099
GetAsString(): 3.7200990
Answers
-
Integer type of DataBuffer but getAsDouble(), what will happen. Basically my application's receiving variable can be a different type. For example I could getDouble() then cast the value into integer. Just want to explore whether I can call getInt64() directly. Same for all Integral DataBuffer, may I call getDouble()?
0 -
Thanks for reaching out to us.
I checked the document and found that "The getInt64 method has been [DEPRECATED]. The setInt and getInt methods provide a simpler interface and can be used to replace the setInt64 and getInt64 methods."
However, the document states that it can throw InvalidUsageException when Illegal DataBuffer Type found.
I recommended checking the type before calling associated methods.
I hope that this information is of help.
0 -
So when come to type handling, must be apple to apple, pear to pear. Otherwise user will get InvalidUsageException error. If necessary, user should convert a value to another type by user code.
0 -
but for Real64Enum/Real32Enum databuffer, user can still use getDouble() as normal double value?
0 -
According to the question, it looks like you are developing a new application with RFA C++.
RFA C++ is a legacy API and we don't recommend developing a new application with the legacy API.
If you are developing a new application to consume real-time data, please consider using the RTSDK C/C++ (EMA C++) instead. Please also refer to the API Compatibility Matrix for the support operating systems and compilers.
0 -
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
- 615 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
- 556 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
- 652 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
- 228 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 中文论坛