[Ask for help]: Met a problem with printf and gcvt

Siddhesh Poyarekar siddhesh.poyarekar@gmail.com
Tue Dec 9 07:11:00 GMT 2014


On 9 December 2014 at 12:38, Wang Weidong <wangweidong1@huawei.com> wrote:
> When I was using the printf() and gcvt(), I got a difference below:
>
> ------------------------------------------------------------
>
> On Uclibc(0.9.31):
>
> printf("%.1f\n",3.25);   ------>3.3
>
> gcvt(1e-100, 20, buf);
> printf("%s\n", buf);     ------>1.0000000000000001e-100
>
> -----------------------------
>
> On Glibc(2.18/2.19/2.11):
>
> printf("%.1f\n",3.25);   ------>3.2
>
> gcvt(1e-100, 20, buf);
> printf("%s\n", buf);     ------>1e-100
>
> ------------------------------------------------------------
>
> Is it a problem on the uclibc or on glibc?

Obviously a problem with uclibc since it is losing precision.

Siddhesh
-- 
http://siddhesh.in



More information about the Libc-help mailing list