Currently I am trying to match a C# and C++ application. On the C++ side, when there is a value, say:
const char* svalue = "554.1327";
When I use sscanf
:
float x;
sscanf(svalue, "%f", &x);
x
will equate to 554.13269
, i.e. it has "additional" significant figures, even though they may round to the same value. (I think this application uses a different float
type which can hold more than 7 significant figures.)
I do not want to change the C++ side. I would like my seperate C# appliaction to do the same.
For example, if I have the float 23423.29
, I would like to convert it to 23423.289
, which is a double
(since in C#, standard float
has no more than 7 significant figures), then convert that double
into a string.
I cannot seem to find a method to do this. Any ideas? Or do I have to create my own function or call into the same C++ function from the C# side�