I have a program that printf a float that is returned by a function like this:
In w32 my program has been running ok, but when run in a w64, it crash at the printf. If I change the definition of the function to return double it runs ok.Code:printf("%3.1f\n", myfloat()); ... float myfloat(void) { code.... }
For my surprise, in printf format string - Wikipedia, the free encyclopedia , in the "type" section I see there is no definition to print a float, but %f is for double in fixed point.
So the question is what is the correct way to printf a float? must I cast? or is it better to return double? if so, does it have a performance penalty?
After seeing the wikipedia I am a bit confused about it.....