[En-Nut-Discussion] Problem with ARM floating point, again
Harald Kipp
harald.kipp at egnite.de
Wed Jan 30 15:31:50 CET 2013
Me again,
On 30.01.2013 09:52, Harald Kipp wrote:
> a user reported, that printf output of a double float fails on SAM7X
> with Nut/OS 4.10, using the latest Yagarto toolchain.
What I learned so far is, that the problem still exists with a number of
previous releases of the Yagarto toolchain and probably with Linux
toolchains as well. It looks like an alignment problem with newlib's
_dtoa_r function.
Printing floats on Nut/OS for ARM is considered broken until further
notice. If you want to print float values, convert them to integer
first, e.g.
double val = 15.1;
int d = val * 1000;
printf("Float: %d.%03d\n", d / 1000, d % 1000);
I remember similar problems on the AVR platform. IMHO, the best solution
is to provide our own dtoa function. But that's a challenge. All
existing code I found so far is based on the ancient AT&T (later Lucent)
code.
Regards,
Harald
More information about the En-Nut-Discussion
mailing list