Where should I look at if I want to switch between float and double precision at compile time. Its like, if user wants everything in float instead of double precision how I
If it is OK to make the switch at compile time, a simple typedef would do:
typedef
#ifdef USE_DOUBLES typedef double user_data_t; #else typedef float user_data_t; #endif
Use user_data_t in your code, and set USE_DOUBLES if you want doubles at compile time:
user_data_t
USE_DOUBLES
doubles
g++ -DUSE_DOUBLES=1 myprogram.cpp