Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15102

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

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: built-in printf %f parameter format depend on LC_NUMERIC
Date 2019-07-09 14:28 -0400
Message-ID <mailman.701.1562696909.2688.bug-bash@gnu.org> (permalink)
References <5d24be33.1c69fb81.59c43.fe4dSMTPIN_ADDED_BROKEN@mx.google.com> <a212b38c-914d-dda6-8d22-e9039063768e@case.edu>

Show all headers | View raw


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/

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: built-in printf %f parameter format depend on LC_NUMERIC Chet Ramey <chet.ramey@case.edu> - 2019-07-09 14:28 -0400

csiph-web