[ECOS] [Fwd: [ECOS] printf and floating point emulation]

Eduardo Sabaj esabaj@hasar.com
Wed Apr 9 18:46:00 GMT 2008


Andrew, the program fails with the printing of any floating point 
number. Anyway, what I'm printing is :

        printf ("main: %f\n", 2.345);

The lines below were produced by the test program in:

	packages/language/c/libc/stdio/current/tests/sprintf1.c

When the program reaches the first line with a %f format it hangs:

	// Check 18
	ret = sprintf(x, "%f", 2.5);

By the way, I downloaded the latest eCos version with the following command:
	
	cvs -z3 -d :pserver:anoncvs@ecos.sourceware.org:/cvs/ecos co -P ecos

Any idea?

Regards,
Eduardo

----

INFO:<Starting tests from testcase sprintf1.c for C library sprintf() 
function>
INFO:<These test individual features separately>
PASS:<%d test>
PASS:<%d test return code>
PASS:<%s test>
PASS:<%s test return code>
PASS:<padding test>
PASS:<padding test return code>
PASS:<hex conversion (lowercase)>
PASS:<hex conv (lowercase) return code>
PASS:<hex conversion (uppercase)>
PASS:<hex conv (upperbase ) return code>
PASS:<%c test>
PASS:<%c test return code>
PASS:<octal conversion>
PASS:<octal conversion return code>
PASS:<%u test>
PASS:<%u test return code>
PASS:<%n test>
PASS:<%n test return code>
PASS:<%% test>
PASS:<%% test return code>
PASS:<%ld test>
PASS:<%ld test return code>
PASS:<%lu test>
PASS:<%lu test return code>
PASS:<%x test>
PASS:<%x test return code>
PASS:<%X test>
PASS:<%x test return code>
PASS:<%0x test>
PASS:<%0x test return code>
PASS:<%0X test>
PASS:<%0X test return code>
PASS:<%p test return code>
INFO:<Starting floating point specific tests>

----

Andrew Lunn escribió:
> On Wed, Apr 09, 2008 at 01:04:03PM -0300, Eduardo Sabaj wrote:
>   
>> I found that the problem is the function vfnprint () located in  
>> vfnprintf.cxx. It calls cvt() and this function calls modf(). This last  
>> function seems to be the problem. This is the code extracted from cvt() :
>>                ...
>>        for (p = endp - 1; integer; ++expcnt) {
>>                tmp = modf(integer / 10, &integer);
>>                *p-- = to_char((int)((tmp + .01) * 10));
>>        }
>>                ...
>>
>> This loop never ends!
>>
>> Am I omiting any patch? Please I need help. If you have any suggestion  
>> write me as soon as you can.
>> Regards,
>> Eduardo
>>     
>
> Can you give a concrete example. Something like
>
> main()
> {
>         printf("%.2f\n, 3.141539);
> }
>
> which causes the problem. Does the value being printed matter?
>
> What happens when you run the test program
> packages/language/c/libc/stdio/current/tests/sprintf1.c
>
>       Thanks
>         Andrew
>
>   


-- 

Ing. Eduardo Salvador Sabaj
Analista de Desarrollo

Compañía Hasar | Grupo Hasar*
*Marcos Sastre y José Ingenieros
El Talar. Pacheco
[B1618CSD] Buenos Aires. Argentina
Tel [54 11] 4117 8900 | Fax [54 11] 4117 8998
E-mail: esabaj@hasar.com
Visítenos en: www.hasar.com
<http://www.hasar.com>Información legal y política de confidencialidad: 
www.grupohasar.com/disclaimer <http://www.grupohasar.com/disclaimer>


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list