capricorn one
Well-known member
Trying to printf with %e and %f, looks like it's not included in the compiler options for the LC. Anyone know the flag to add it? Can't seem to find it in all my searching.
I realize I may have to use dtostrf, but what I really need is dtostre, which doesn't appear to be included either. Any options out there for me to print in scientific notation without rewriting hundreds of lines of my program?
EDIT
Doing some digging, if you compile with optimization at FAST or greater, you get the printf floats, but in the smallest code optimization you don't. That's understandable, the difference unfortunately is huge. When compiling with FAST my code is 65K, when using SMALLEST, it's 35K. I know the floating point printf requires a lot of space, but I know it's less than 30K, would be nice to be able to add it while still optimizing the rest of the code for smallest. Anyone know how to do that?
I've come across a lot of posts suggesting adding this flag to the linker : -u _printf_float
Unfortunately, it compiles, but crashes when executing printf with a float.
I realize I may have to use dtostrf, but what I really need is dtostre, which doesn't appear to be included either. Any options out there for me to print in scientific notation without rewriting hundreds of lines of my program?
EDIT
Doing some digging, if you compile with optimization at FAST or greater, you get the printf floats, but in the smallest code optimization you don't. That's understandable, the difference unfortunately is huge. When compiling with FAST my code is 65K, when using SMALLEST, it's 35K. I know the floating point printf requires a lot of space, but I know it's less than 30K, would be nice to be able to add it while still optimizing the rest of the code for smallest. Anyone know how to do that?
I've come across a lot of posts suggesting adding this flag to the linker : -u _printf_float
Unfortunately, it compiles, but crashes when executing printf with a float.
Last edited: