Please fill out a bug report at the avr-libc project on the Savannah website.
https://savannah.nongnu.org/projects/avr-libc Otherwise, your email will get lost quickly in our inboxes. Eric > -----Original Message----- > From: [email protected] [mailto:avr- > [email protected]] On Behalf Of > [email protected] > Sent: Thursday, February 24, 2011 12:43 AM > To: [email protected] > Subject: [avr-chat] Bug in atof shipped with avr-libc? > > Hi all: > > I think I've found a bug in the version of atof that ships with the > latest/last version of Winavr. > > When I pass it a string with a floating point number, the number it > returns is incorrect. > > For example, I can pass it '-1033\0', and the result is something like - > 15640. Similarly, I can pass it '0.33', and the result is 16000 and > something. It seems that the only thing it gets right are the sign and > when the input string is '0.00'. > > I have reimplemented atof as my_atof, and it works perfectly. > > Note that this incorrect behaviour is also apparent in avr-gcc shipped > with ubuntu 10.04.2. > > An example of code that demonstrates the behaviour is below: > > float atof_test(void){ > static char buf[10]; > char* pbuf = buf; > > buf[0] = '-'; > buf[1] = '0'; > buf[2] = '.'; > buf[3] = '3'; > buf[4] = '3'; > buf[5] = '\0'; > > return atof(pbuf); > } > > Cheers, > -- > Matt van de Werken > Electronics Engineer > Mining Geoscience, CSIRO Earth Science and Resource Engineering > 1 Technology Ct Pullenvale QLD 4069 > P: 07 3327 4142 F: 07 3327 4455 M: 0400 538 608 > E: [email protected] > "Those that do not understand UNIX are condemned to reinvent it, poorly" > - Henry Spencer > _______________________________________________ > AVR-chat mailing list > [email protected] > http://lists.nongnu.org/mailman/listinfo/avr-chat _______________________________________________ AVR-chat mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-chat
