There are a couple of things that I don't understand. For one thing, Cortex-M4 hardware floating point is only for 32-bit 'float' types. Isn't that correct? printf and friends only deal only with type double. floats are expected to be converted to type double when they provided to printf.
Yes, that is correct. The FPU only supports single precision values.
You are looking at the value that is passed as input to dtoa and it is a correctly converted type double, correct? So the bottom line is that the inputs to dtoa are the same with and without hard floating pointing point, but the output from dtoa appears to differ with hard floating point enabled. Is that a correct assessment?
Also correct, the double parameter has the right value, but the string returned from dtoa is bad.
So to me, that would mean that something internal to the dtoa implementation is behaving differently with hardware floating point enabled. I wonder what would happen if you compiled that one file containing dtoa with software floating point.
I don't think I would be able to link it then?
Another thing that I don't understand is that other people are using hardware floating point. While I have heard a lot of complaints about dtoa, I haven't heard one before that is unique to hardware floating point being enabled.
When I get a chance, I'll try this on another test board with a similar arch and see if it has the same problem.
Several bugs have been reported recently in the printf floating point conversion (by me and by Mike Smith). But I think that in all cases, the error was not really in dtoa() itself, but in the glue larger that converts the dtoa() return values to a printable string. Have you verified that dtoa() is actually returning bad values? Or is it returning good values that get mishandled after that?
Dtoa() is returning the bad values.
One thing I tried was porting dtoa.c (attached) from the GCC trunk here http://gcc.gnu.org/viewcvs/trunk/libjava/classpath/native/fdlibm/dtoa.c?view=markup to see if that had the same behavior, which it did. Perhaps it's something to do with the Atollic pro 3.2.0 compiler I'm using.
When I have the time, I'll try to trace the execution through dtoa.c step by step with soft/hard float so the divergence can be pinpointed.
Ryan