[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: built-in printf %f parameter format depend on LC_NUMERIC
From: |
Chet Ramey |
Subject: |
Re: built-in printf %f parameter format depend on LC_NUMERIC |
Date: |
Tue, 9 Jul 2019 14:28:09 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 |
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/
- built-in printf %f parameter format depend on LC_NUMERIC, lea . gris, 2019/07/09
- Re: built-in printf %f parameter format depend on LC_NUMERIC,
Chet Ramey <=
- Re: built-in printf %f parameter format depend on LC_NUMERIC, Dennis Williamson, 2019/07/09
- Re: built-in printf %f parameter format depend on LC_NUMERIC, Léa Gris, 2019/07/09
- Re: built-in printf %f parameter format depend on LC_NUMERIC, Chet Ramey, 2019/07/09
- Re: built-in printf %f parameter format depend on LC_NUMERIC, Léa Gris, 2019/07/12
- Re: built-in printf %f parameter format depend on LC_NUMERIC, Chet Ramey, 2019/07/12
- Re: built-in printf %f parameter format depend on LC_NUMERIC, Eli Schwartz, 2019/07/12
- Re: built-in printf %f parameter format depend on LC_NUMERIC, Chet Ramey, 2019/07/12
- Re: built-in printf %f parameter format depend on LC_NUMERIC, Dennis Clarke, 2019/07/12
- Re: built-in printf %f parameter format depend on LC_NUMERIC, Chet Ramey, 2019/07/12
- Re: built-in printf %f parameter format depend on LC_NUMERIC, Dennis Clarke, 2019/07/12