GCC's Decimal Floating Point extension problem
H.J. Lu
hjl.tools@gmail.com
Tue Sep 11 18:35:00 GMT 2012
On Tue, Sep 11, 2012 at 11:31 AM, Mohamed Abou Samra
<my_abousamra@yahoo.com> wrote:
> Hi All,
>
> I'm trying to write a small program to check the decimal floating point gcc extension but I encountered some problems
>
> The program just converts a _Decimal64 number to double to print it and I used the function (double __bid_truncdddf (_Decimal64 a) as the gnu online docs show)
>
> #include <stdio.h>
>
> int main ()
> {
> _Decimal64 d = 12.5DD;
> printf ("%lf\n",__bid_truncdddf(d) );
>
> return 0;
> }
>
> $ gcc test.c -Wall -g
> test.c: In function ‘main’:
> test.c:23: warning: implicit declaration of function ‘__bid_truncdddf’
> test.c:23: warning: format ‘%lf’ expects type ‘double’, but argument 2 has type ‘int’
>
> $ ./a.out
> 0.000000
>
> I don't know why the result is zero and why the second warning appears although I wrote the function properly!
>
>
,__bid_truncdddf is a libgcc internal function. Don't ever use it
in user programs. Just cast DFP to double.
--
H.J.
More information about the Gcc
mailing list