Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Dennis Williamson Newsgroups: gnu.bash.bug Subject: Re: built-in printf %f parameter format depend on LC_NUMERIC Date: Tue, 9 Jul 2019 13:52:23 -0500 Lines: 56 Approved: bug-bash@gnu.org Message-ID: References: <5d24be33.1c69fb81.59c43.fe4dSMTPIN_ADDED_BROKEN@mx.google.com> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: usenet.stanford.edu 1562698371 5030 209.51.188.17 (9 Jul 2019 18:52:51 GMT) X-Complaints-To: action@cs.stanford.edu Cc: lea.gris@noiraude.net, bug-bash To: Chester Ramey Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sAM6FWlPKpYzZNpiBme/k8H8P3jXJa0OVCZnjgFqYEw=; b=sO2NKVPhzSAjWK1Gcj09q//HEvc7yz1ZOqT+Ds7DagmXysScU0Z9aB2G6iFMX45p8m Ox0KvQ7TWhKsRp+jbrd0ZEBSsUReSY5wLTNfNkkmOg6cA/oByERnCPP4vkXNDsS11Evn oR42AON6zkNYCb4IJnsGy2mxc8six8kiC3WXJYodeDBo2hY5ZP9Ze2bE+E3fT6xAb4d8 M2fpTU/x+QWVi40EkKmivPQvkxeO+9s+omKM7AUtyq3JBwG7foR1DnOgzPE04py3Wx+e 7HJcWx6ffwRwpr2+OgnfWjvlA4lc5JiVOkmgcz3Ct/IgfNugBxgsT7nEhl+Z0N6fODzX DdUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sAM6FWlPKpYzZNpiBme/k8H8P3jXJa0OVCZnjgFqYEw=; b=es0KqEvitjYRPjLg3bQ44d0+eKhRky2rPzn5fKj8pWBiRYD099+wcH32SBUWnjudUd ErHP0BU98bdTqsskPh+VwilqAIYkxzHwPL/hpEpqlVD8AX0MXK4lsEV6OowTAvWJpMKO LUWKuJbd2Fhy0BBzG4jHUqUx+csY8hIUGdpr2LbpKfHrwC+d3/kVmtDn3Zwwa7GOClr5 gAN3RiYsATqrPWHZg+JGXt/pe1mGhK6bTJyyPOIZ51rjQ0CfVkF3FtGBgVrq4D4xa8ZZ YioVzyEkoFHy/hBwnNKKg7+K13GEteXtpw486QqMJs6sVLh60guJalqTlZsjYXVaSces VBxw== X-Gm-Message-State: APjAAAU0qPn54O9Ojk6Y2Qkjp7OkRi763n+WR2zPZikOyC+lfjEWOgGO JlWh/fWr9P9xR5PkNLePzsT6ZvFmuCb+MMwI2KMbq3Y= X-Google-Smtp-Source: APXvYqzEoMH89E10ihKJxN/vQ8BfO1a/j+rOkKtwUUXO4rcZx2dfSRtrOotJOPgUr1darngXZesEmGtjVfBt+1c8JhI= X-Received: by 2002:a5d:498f:: with SMTP id r15mr25126368wrq.353.1562698354201; Tue, 09 Jul 2019 11:52:34 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <5d24be33.1c69fb81.59c43.fe4dSMTPIN_ADDED_BROKEN@mx.google.com> Xref: csiph.com gnu.bash.bug:15104 >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=E2=80=90 tive to the draft and traditional implementations. and 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 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#t= ag_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/ > > --=20 Visit serverfault.com to get your system administration questions answered.