Reputation: 241
As while porting 64 bit project to 32 bit project for making range compatible changed:
typedef float float_t;
to
typedef long double float_t;
All goes perfect but error is coming in all printf specifier for %f. I don't want to change to %Le in whole code.
Please suggest any generic solution so it is campatible to both 32 bit and 64 bit system in c language.
Upvotes: 0
Views: 219
Reputation: 28802
You did not sepcify what language you are using. In C++ std::cout
is preferred over printf
and it will give you type-correct formatting.
If you are using C, you could define a macro based on the platform for both the type of the floating point variables and the formatting string for printf
Upvotes: 0
Reputation: 7127
You are going to have to use a #define for the format string for the float / long double, or use a special formatting function
Upvotes: 3