[uClibc]Problem when I try to print fp numbers with fprintf

George Thanos gthanos at telecom.ntua.gr
Thu May 29 11:45:56 UTC 2003


Dear list,

I am working on a uClinux-uClibc port on the Hyperstone's E132XS processor. Developmnent is its last stages before making our work public to the OS community.

We still face some development problems... To mention one, when I try to print a floating point number using a stream, through printf/frpintf etc, the printed result is incorrect. I can nicely print integers or strings and as a general rule printf seems to work OK in all other cases. 

I assume that the problem is related to the floating number parsing. I tried to inspect the FP number parsing procedure, but it results to complicated code that I cannot follow. In fact I was not able to point out where the parsing is actually done.

For fp number representation our compiler (gcc 2.95.2) uses the well-known ANSI/IEEE 754-1985 standard.
(Short description below...)

                   Sign     Exponent     Fraction     Bias 
Single Precision   1 [31]   8  [30-23]   23 [22-00]   127 
Double Precision   1 [63]   11 [62-52]   52 [51-00]   1023

I usually receive very small fp numbers when I try to print them (i.e. 0.00005). The hex number value is correct, I have tested it manually by converting it to float. Furthermore when using the vendor specific RTOS, alternatively to Linux and compile applications with the same compiler result is correct.

Variable width parameter passing to fprintf is also correct. ( I have tested it but also fprintf works well in all other cases as already mentioned..)

Is it possible to specify a possible cause of error based on the above symptoms. Is there any area of the uClibc code that should be examined in relation to fp? I have to note that no fp instructions have taken place yet...

Do you think that the parsing of fp numbers in vfprintf is a good point to start? Could you specify exactly the point that uClibc does this parsing?

Thanks in advance,

- George




More information about the uClibc mailing list