Re: float

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/1/2010 19:11, Michal Nazarewicz wrote:
>> On 8/1/2010 18:30, phoenixxz wrote:
>>     
>>> float i=1.34;
>>> printf("%f",i);
>>>
>>> ->> 0
>>> why?
>>>       
> Nanakos Chrysostomos <linuxcprog@xxxxxxxxxxxx> writes:
>   
>> printf("%lf",i);
>>     
> %lf is actually invalid format (though glibc will gladly treat it the
>  same way it treats %f).  When passing a float value to a function with
>  variable number of arguments it is promoted to double.
>
>   
It could then be:

printf("%lf", (double)i);
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux