Imported from previous forum
[ original email was from Hillary Fernandes - hfernand@cme.com ]
I am trying to model a generic Price field, but I need to have the option of getting the information in 999.99 format or the user could send me 99999, with a decimal locator attribute for that tag. So if the decimal locator attribute has a value of 3, the application program will give a result of 99.999.
Has anyone come across this issue? Can this be modeled/handled differently.
Hillary Fernandes
CME
[ original email was from Himanshu Sharma - himanshu.sharma@schwab.com ]
Nice idea. I have seen that when I assign price value to a float variable in C(++), it gets distorted, in a sense that decimals are not exact.
Its good to have integer and decimal value separately for better precision.
> I am trying to model a generic Price field, but I need to have the option of getting the information in 999.99 format or the user could send me 99999, with a decimal locator attribute for that tag. So if the decimal locator attribute has a value of 3, the application program will give a result of 99.999.
>
> Has anyone come across this issue? Can this be modeled/handled differently.
>
> Hillary Fernandes
> CME
>
All data representation in FIX is in text and thus all numbers can have arbitrary precision. I suggest using the logical external floating point "nnnn.dddd" representation and internally modelling it to your requirements, e.g., two integers holding the "nnnn" and "dddd" portions.
> I am trying to model a generic Price field, but I need to have the option of getting the information in 999.99 format or the user could send me 99999, with a decimal locator attribute for that tag. So if the decimal locator attribute has a value of 3, the application program will give a result of 99.999.
>
> Has anyone come across this issue? Can this be modeled/handled differently.
>
> Hillary Fernandes
> CME
>