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


Groups > gnu.bash.bug > #15102 > unrolled thread

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

Started byChet Ramey <chet.ramey@case.edu>
First post2019-07-09 14:28 -0400
Last post2019-07-09 14:28 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

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

FromChet Ramey <chet.ramey@case.edu>
Date2019-07-09 14:28 -0400
SubjectRe: built-in printf %f parameter format depend on LC_NUMERIC
Message-ID<mailman.701.1562696909.2688.bug-bash@gnu.org>
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/

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web