To omnius:
you send the output on screen using cout. try using printf.
I found the solution, I've called it '_ftod':
Code:
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
double _ftod(float fValue)
{
char czDummy[30];
sprintf(czDummy,"%9.5f",fValue);
double dValue = strtod(czDummy,NULL);
return dValue;
}
int main(int argc, char* argv[])
{
float fValue(250.84f);
double dValue = _ftod(fValue);//good conversion
double dValue2 = fValue;//wrong conversion
printf("%f\n",dValue);//250.840000
printf("%f\n",dValue2);//250.839996
getch();
return 0;
}
JasonD said something about precision. Et voilą.
Thanks you all for sparing the moment to look at my problem:
bennyandthejets, Omnius, quagsire and JasonD