I have a lengthy numeric integration scheme written in C. I\'d like to test my algorithm in floating point precision. Is there a way to tell gcc to demote every occurrence o
typedef double float;
Before any doubles that you want to replace should work, however be warned it may confuse some external libraries.
In the future, the best approach is to define your own float type:
#ifdef USE_FLOATS
typedef float MyFloatType;
#else
typedef double MyFloatType;
#endif
Or use templates, which has the added benefit of allowing you to change the code at runtime to use one or the other.