bug-coreutils
[Top][All Lists]
Advanced

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

bug#7829: locale-related printf bug when using formats with thousands gr


From: Eric Blake
Subject: bug#7829: locale-related printf bug when using formats with thousands grouping character
Date: Wed, 12 Jan 2011 06:58:19 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7

[redirecting to bug-coreutils]

On 01/12/2011 06:52 AM, Eric Blake wrote:
>> bash-4.1$ printf "%'.2f\n" 999999.9998071828
>> ,000,000.00
>>
> It appears that glibc fails to account for the fact that rounding may
> increase the number of result characters by 2 instead of 1 when %' is in
> effect (going from 999 to 1,000, at any power of 10*3).
> 
> Please file a glibc bug, and in the meantime, gnulib should consider
> modifying the printf-posix family of modules to work around this
> rounding bug.

Ouch - coreutils' printf is also affected:

$ /usr/bin/printf %\'.2f\\n 999.9998 999999.9998 1000000
1000.00
,000,000.00
1,000,000.00

At least printf(1) already uses the xprintf-posix module, so hopefully
this gets fixed once gnulib works around the glibc bug.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]