[Top][All Lists]

[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 Williamson
Subject: Re: built-in printf %f parameter format depend on LC_NUMERIC
Date: Tue, 9 Jul 2019 13:52:23 -0500

>From the bc man page on Ubuntu:

This version of bc was implemented from the POSIX P1003.2/D11 draft and
contains several differences and extensions rela‐
       tive  to the draft and traditional implementations.


LANG environment
              This  version  does  not  conform to the POSIX standard in
the processing of the LANG environment variable and all
              environment variables starting with LC_.

On Tue, Jul 9, 2019 at 1:29 PM Chet Ramey <chet.ramey@case.edu> wrote:

> On 7/9/19 11:26 AM, lea.gris@noiraude.net wrote:
> > Bash Version: 5.0
> > Patch Level: 3
> > Release Status: release
> >
> > Description:
> >         When formatting floating point numbers in Bash's built-in
> >         printf with %s, the argument format depends on the LC_NUMERIC
> >         environment variable.
> As POSIX requires:
> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_04
> The `decimal_point' member of the LC_NUMERIC category defines the radix
> character in floating point numbers, for both input and output.
> >         If the LC_NUMERIC language defines a comma , as decimal
> >         separator, the built-in printf will not be able to recognize
> >         floating-point numbers using a decimal point . as it is when
> >         using the result of bc
> This depends on the behavior of strtold/strtod. POSIX requires strtod to
> honor the radix character as defined in LC_NUMERIC. Since LC_NUMERIC
> determines the radix character for input and output, it looks like `bc'
> is not POSIX conformant.
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Visit serverfault.com to get your system administration questions answered.

reply via email to

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