Incorrect output is displayed for FLOAT data type in C
myDouble = Double Data type
tmpptr = char* which holds actual data
myDataLen = no of Bytes for FLoat
I am using above code snipet to map Float Data type to C equivalent DOuble data type as both wll be 8 bytes of data.
In above I facing issue like the value of precision if getting rounded of if its exceedss 6 digits.
Currently getting output :
But My ask is to have the value as such like in source table.
I tried with different format specifiers in c like %.15f , %g , %lf .... nothing worked.
Please give some idea to solve this issue.
Did you try format %10.8f? That should work. E.g.,
sprintf("pi = %18.16f",4*atan2(1,1)) produces "pi = 3.1415926535897931"
If you need greater precision try using the number data type (up to 38 digits), and cast it as character when retrieving it.