by the way, in an earlier email I had with others in this mailing list, printf
and long doubles was discussed in depth. there is no support for long doubles
in any C I/O library (but who knows, maybe iostream works).
my code is a little different. it tests iostream as well and there is a bug in
iostream's handling of long double.
#include <stdio.h>
#include <iostream>
using namespace std;
int main ()
{
long double d = 16.125e-08;
double e = 8.125e-08;
printf ("ge=%g (f)\n", (float)e);
printf ("ge=%g\n", e);
printf ("fe=%f (f)\n", (float)e);
printf ("fe=%f\n", e);
printf ("ee=%e\n", e);
printf ("gd=%g (d)\n", (double)d);
cout<<"d="<<d<<endl;
return 0;
}
ge=8.125e-008 (f)
ge=8.125e-008
fe=0.000000 (f)
fe=0.000000
ee=8.125000e-008
gd=1.6125e-007 (d)
d=-3.07777e-091
e=8.125e-008
this bug exists in i686 32-bit target as well, and in 20110404 automated build,
non-1.0 and in 20110513.
/libiberty/vasprintf.c does most of the type handling of printf.
/libiberty/_doprnt.c seems to do the heavy lifting.
>________________________________
>From: Little <[email protected]>
>To: [email protected]
>Sent: Tuesday, April 26, 2011 3:56 PM
>Subject: Re: [Mingw-w64-public] printf %f format does not work to print
>doubles/floats
>
>It's a new problem after 4.7-20110416.
>
>
>
>-----Original Message-----
>From: Simon de Graaf [mailto:[email protected]]
>Sent: Wednesday, April 27, 2011 11:31 AM
>To: [email protected]
>Subject: Re: [Mingw-w64-public] printf %f format does not work to print
>doubles/floats
>
>Yes, i have the same output (tested on XP Prof. 64 bit).
>I also verified my old 64 bit cross-compiler tree
>and it has the same problem
>( archive: mingw-w64-bin_i686-linux_20100224.tar.bz2 ).
>Thanks for your help and quick response.
>
>On 27/04/11 17:17, Ozkan Sezer wrote:
>> On Wed, Apr 27, 2011 at 5:42 PM, Simon de Graaf<[email protected]>
>wrote:
>>> Automatic build:
>>>
>>> mingw-w64-bin_i686-linux_20110423.tar.bz2
>>>
>>> Program code:
>>>
>>> #include<stdio.h>
>>>
>>> int main ()
>>> {
>>> long double d = 16.125e-08;
>>> double e = 8.125e-08;
>>>
>>> printf ("ge=%g (f)\n", (float)e);
>>> printf ("ge=%g\n", e);
>>> printf ("fe=%f (f)\n", (float)e);
>>> printf ("fe=%f\n", e);
>>> printf ("ee=%e\n", e);
>>> printf ("gd=%g (d)\n", (double)d);
>>> return 0;
>>> }
>>>
>>> Compile command:
>>>
>>> % bin/x86_64-w64-mingw32-gcc -Wall zbla2.c -o zbla2.exe
>-static
>>>
>> Hmm, exe from my own personal build (gcc-4.4.x + mingw-w64 release
>> branch rev.4150) prints expectedly (I guess), like:
>>
>> ge=8.125e-008 (f)
>> ge=8.125e-008
>> fe=0.000000 (f)
>> fe=0.000000
>> ee=8.125000e-008
>> gd=1.6125e-007 (d)
>>
>> I first suspected about the mingw_printf changes in the trunk, but the
>> code doesn't make use of them. Hmm. Can't be sure right now.
>>
>> Opinions?
>>
>> --
>> Ozkan
>>
>>> On 27/04/11 16:32, Ozkan Sezer wrote:
>>>> On Wed, Apr 27, 2011 at 5:27 PM, Simon de Graaf<[email protected]>
>wrote:
>>>>> Hi,
>>>> Hi: we might need a little bit more detail,
>>>>
>>>>> I downloaded the latest cross-compiler and found out
>>>> Precisely which one?
>>>>
>>>>> that the printf %f format does not work to print doubles/floats.
>>>>> It gives back a zero value.
>>>>>
>>>> Can you please post your code and describe how you compile
>>>> and link it?
>>>>
>>>>> Regards
>>>>> Simon de Graaf
>>>> --
>>>> O.S.
>>
>----------------------------------------------------------------------------
>--
>> WhatsUp Gold - Download Free Network Management Software
>> The most intuitive, comprehensive, and cost-effective network
>> management toolset available today. Delivers lowest initial
>> acquisition cost and overall TCO of any competing solution.
>> http://p.sf.net/sfu/whatsupgold-sd
>> _______________________________________________
>> Mingw-w64-public mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
>----------------------------------------------------------------------------
>--
>WhatsUp Gold - Download Free Network Management Software
>The most intuitive, comprehensive, and cost-effective network
>management toolset available today. Delivers lowest initial
>acquisition cost and overall TCO of any competing solution.
>http://p.sf.net/sfu/whatsupgold-sd
>_______________________________________________
>Mingw-w64-public mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
>------------------------------------------------------------------------------
>WhatsUp Gold - Download Free Network Management Software
>The most intuitive, comprehensive, and cost-effective network
>management toolset available today. Delivers lowest initial
>acquisition cost and overall TCO of any competing solution.
>http://p.sf.net/sfu/whatsupgold-sd
>_______________________________________________
>Mingw-w64-public mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
>------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public