question

Upvotes
Accepted
5 0 3 6

ThomsonReuters.RFA.Data.Real conversion to decimal

The guide of Thomosn. Reuters included that Real has hint to convert the long value to decimal value , can you help me how to do that especially i could not conclude the way from manual

treprfarfa-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
13k 32 12 18

The RFA.Data.Real has two properties -

Value - Data. Type: long
MagnitudeType- enumerated hint for how the value is to be interpreted. Type: RFA.Data.MagnitudeTypeEnum

Lets assume, you receive a message like this:

>>dataBuffer.Real
{Value : 44370000
MagnitudeType : 8
}

Here the magnitude value of 8 expands to ExponentNeg6 (= 10^-6). So the resulting value should be interpreted as 44.370000.

If you know that RFA.Data.DataBuffer is of type Real, you can also use a handy property .Double to directly get the floating point number.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Thank you very much dear , of course I know the nice RFA.NET .Double , but for some reason related to type of project I work in I have to use data in decimal data type not in float or double data type.Althugh , using double and float is great and easy way

I checked the Enum MsgTypeEnum , now if I have values like : Divisor4 ExponentPos7 NegInfinity what is the best decision to do

I think for ExponentPos7 I have to move the comma of precision to right , but what about the other types like : Divisor , Infinity,NegInfinity , Exponent0 , ExponentPos?

I tried this method I wonder if it is true ?! if I had MagnitudeType divisor8 then : value number / 8 and so on . if I had Exponent0 then the value is power to 0 which means result =0 ?

Where did you get MsgTypeEnum from? The RFA.Data.Real has magnitude as defined in RFA.Data.MagnitudeTypeEnum.

Exponent0 = 10^0 = 1. So result = value * 1.

Divisor8 = 1/8. Result = value / 8.

ExponentPos5 = 10^5. Result = value * 100000

NegInfinity. Result = -∞

All other values are self explanatory.

Show more comments
Show more comments
Upvotes
665 3 5 6

Hello @omar.isaid1

Real consist of (byte) MagnitudeType and (long) Value members; The Value specifies the mantissa - the value as a whole number, the MagnitudeType indicates the fraction or exponent which applies to this Value member that would yield a decimal value. MagnitudeType values are defined in MagnitudeTypeEnum, for example, MagnitudeTypeEnum.ExponentNeg2 indicates power of -2 So as an example the decimal value 32.35 can be represented using Real like this:

real.MagnitudeType = MagnitudeTypeEnum.ExponentNeg2;

real.Value = 3235;

The decimal value could be obtained like this:

decimal dec = (Decimal)real.Value / 100;

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea