newlib printf %f BUG
J. Johnston
jjohnstn@cygnus.com
Thu Jan 18 13:46:00 GMT 2001
Ted Merrill wrote:
>
> I hope this is where to report bugs.
>
> Using both newlib-1.8.2 and newlib-1.9.0 compiled using gcc for ARM/thumb
> architecture using gcc 3.0,
> a bug in printf floating point formatting is seen for some numbers.
>
> Sample code:
>
> void MathTest2(void)
> {
> /* This tests a bug we found in newlib 1.8.2
> */
> double R = 3.4263125;
> printf("%.6f\n", R );
> }
>
Ted,
Have you tried this using the latest newlib sources? Newlib 1.9.0 is simply
a snapshot. A number of fixes have been applied to these sources, including
at least one fix to printf %f.
Are you specifying any special options on the compile/link? If so,
you should consider doing a unified source-tree build so that gcc can
locate the proper newlib based on your options.
Using the latest newlib sources and the armulator simulator, I am able to
get the accompanying test case to print the correct value. I am using default
options and because I did not do a unified build, I had to copy the crt0.o
file to my test directory. My arm-elf-gcc is slightly ahead of yours.
Regards,
-- Jeff J.
#include <stdio.h>
int main()
{
/* This tests a bug we found in newlib 1.8.2
*/
double R = 3.4263125;
printf("%.6f\n", R );
}
>% arm-elf-run a.out
3.426312
More information about the Newlib
mailing list