bug-bash
[Top][All Lists]
Advanced

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

Re: built-in printf %f parameter format depend on LC_NUMERIC


From: Dennis Clarke
Subject: Re: built-in printf %f parameter format depend on LC_NUMERIC
Date: Fri, 12 Jul 2019 15:55:17 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.0

On 7/12/19 3:50 PM, Chet Ramey wrote:
On 7/12/19 3:46 PM, Dennis Clarke wrote:

uh huh ...

          LC_NUMERIC

              This category specifies the  decimal  and  thousands
              delimiters.  The  information  corresponding to this
              category is stored in a  database   created  by  the
              localedef()    command.   The   default   C   locale
              corresponds to "." as the decimal delimiter  and  no
              thousands  delimiter.  This  environment variable is
              used by localeconv(3C), printf(3C), and strtod(3C).

I assume this means that bc doesn't use strtod.


I dunno ... I am surprised here. I thought *everything* in strict POSIX
and XPG4/XPG6 compliant systems were locale aware and neatly smart about
how to talk to the user.

Here is "C" or "POSIX" locale :
corv $
corv $ df -h
Filesystem             Size   Used  Available Capacity  Mounted on
jupiter_zones/z/001     95G    85G       9.8G    90%    /
/dev                    95G    85G       9.8G    90%    /dev
proc                     0K     0K         0K     0%    /proc
ctfs                     0K     0K         0K     0%    /system/contract
mnttab                   0K     0K         0K     0%    /etc/mnttab
objfs                    0K     0K         0K     0%    /system/object
swap                   8.0G    74M       7.9G     1%    /etc/svc/volatile
fd                       0K     0K         0K     0%    /dev/fd
swap                   8.0G    74M       7.9G     1%    /tmp
swap                   8.0G    74M       7.9G     1%    /var/run
corv $


Now Let's go to France !

corv $ LC_ALL=fr_FR.UTF-8 LC_NUMERIC=fr_FR.UTF-8 df -h
Système de fichiers  Taille Utilisé Disponible Capacité  Monté sur
jupiter_zones/z/001     95G    85G       9,8G    90%    /
/dev                    95G    85G       9,8G    90%    /dev
proc                     0K     0K         0K     0%    /proc
ctfs                     0K     0K         0K     0%    /system/contract
mnttab                   0K     0K         0K     0%    /etc/mnttab
objfs                    0K     0K         0K     0%    /system/object
swap                   8,0G    74M       7,9G     1%    /etc/svc/volatile
fd                       0K     0K         0K     0%    /dev/fd
swap                   8,0G    74M       7,9G     1%    /tmp
swap                   8,0G    74M       7,9G     1%    /var/run
corv $

Yep.  Perfect.

And then there is "bc" which seems to care less.  Yep, I just gotta look
at the sources.


--
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional



reply via email to

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