I am using float variable in my code, and I get an error because of exceeding the limit size of code. If I replace the float with double variale the code size reduces to 99% which is capable to execute. I was expecting the opposite, because double holds 8 bytes and float 4 bytes. Any clues?
Note: I am using GNU 4.1.1
Extra instructions to convert between float and double?
The traditional math library functions are using double, not float. Depending on supported standard, some compilers has the extra float versions oof the runtime library. However, if you use sqrt() instead of sqrtf(), your float variables will be converted to double before being used.
according to what u say, means the code size should remain the same...which is not the case....
Err ... no ?
If you use float, then the compiler needs to insert extra code to convert float to double when calling math functions.
If you use double to begin with, the compiler doesn't need to generate extra code when you call math functions.