Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15147
| Path | csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Léa Gris <lea.gris@noiraude.net> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: built-in printf %f parameter format depend on LC_NUMERIC |
| Date | Fri, 12 Jul 2019 21:55:53 +0200 |
| Lines | 122 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.1055.1562961362.2688.bug-bash@gnu.org> (permalink) |
| References | <5d24be33.1c69fb81.59c43.fe4dSMTPIN_ADDED_BROKEN@mx.google.com> <a212b38c-914d-dda6-8d22-e9039063768e@case.edu> <6468b45e-5b4a-8edf-4ab8-0838843beaaf@noiraude.net> <b6f65b6b-1487-0c46-6530-fa6d700ff1ca@case.edu> <7c757690-24bd-7b1a-cf8e-af63cbe05216@noiraude.net> <91ed1981-df04-aa06-b108-23c7f89de3b4@case.edu> <405e525c-278e-7779-3c39-3cf58d4bfa1a@noiraude.net> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qglVH7lZey3kReje2zUkiwACqlo49qHes" |
| X-Trace | usenet.stanford.edu 1562961362 12752 209.51.188.17 (12 Jul 2019 19:56:02 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | chet.ramey@case.edu, bug-bash@gnu.org |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=noiraude.net; s=noiraude; h=Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=CgLKvFsAjkNajjmmeTofVBpcEjnytNg4IAezmFlHK6o=; b=fifptZ16r1i0XX+rMysc7OZsb etXvjh15r+PTNPr0LLUxyl1MVh5fNSB9S2yxwcO95eX1mtTpAIlgrrMj8AOnOs/Gpf7R1TeAVMcgO pOrm7LDVCNP0pnKnOzuwV9aZZt4jVjEKd2/lYCQyKnoU6m2a+Me3kR5BOXdFo9HPWsrh2iRtqQL/y U8tYrUYY/xU6kDiYWe1rSqQnXGxIxQuE0dUa370PyQT335cbKLXYdDGskFRdRtjVw72KdBK06sTd8 WVkj8Eu3j0W8ZadZ3r3Ic9jy/jUUZRJrr5w6V3CzQiyvgSXd/SzB7M50DzLTpTY5Kl5dBTg6da5pX r9cLgyPig==; |
| Openpgp | id=2A931E283F202EE5BFCC4F7070946F168078ED52; url=https://www.noiraude.net/8078ED52.asc |
| Autocrypt | addr=lea.gris@noiraude.net; prefer-encrypt=mutual; keydata= mQINBE8OHUcBEADQjtKQcz/T/msKQcvyWEmBz5aKFGYjdErVABpJAiGqNa9m7kr2P5i7iXR/ nuUswsPlVmRxeIWsAMxoU02cwicRoydEJgbZH6KwXMmAynersG70JIobOXF2g5W683pf1R35 PNjrw3sIiQJgpRi2idL0Fvhp8h78fvHkseaomRg8r8zvOQ4AnbWcywDwbZzDVLrMuEUi27Yh j86RaJDcv6P0ygmMiVFHYFyIDBpl2uVbePanpjT8lwzBCJ1MVzc0Bfyi2W0dYlK1dP5pWeQb kMmizpg4SqF0mMSH1Iq8q9AR+M+eN7K2yzpJ3Nez+GurpAkXEdomCF9CkKQbRRbR+AiZfl6n cJwg0+dhJn70vSwdEyRHlX/39ZZA9v4PC18Ukjf9nY9Bb3vl8M5Mo/g9zHertjPlQcGwOubn 05fuehh7H4kUAPhT0w/6R05gT/lw2e89i7TP/Qxixc00DU6mJX3OEWg23fGt8m22mA92+XQx ZEvAviZSjvj+xL7wP7u9r+4RfNT9N1Ebs9tGXFYIpbBZSKaPFTmzJHILu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kJ2BApi2ln2mvH0bq75mwV LS60M74u3ryiHGUDgDxO6dUfZ5paBia3+iW99Pfcf9HZtj+4FC861X5fsCwL3oXvEoToJWjX 3GbP7w/7XyYrxprQy+h8f21ouIgIRzNKDgdScCCepf/M9UdotysxW0zEYAv62ywCuSF+1lhU BfU8IvILfMe+rLmasTwsPBkHAJn/oo73R6dda2rkG8RTyLkrvDPbQYzZrYlzlg5TKLUXPPZr I3KbDCDuQHywEBQ= |
| User-Agent | Telnet/1.0 [tlh] (PDP11/DEC) |
| In-Reply-To | <91ed1981-df04-aa06-b108-23c7f89de3b4@case.edu> |
| X-detected-operating-system | by eggs.gnu.org: Genre and OS details not recognized. |
| X-Received-From | 2001:910:10c6:1::1 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.23 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <https://lists.gnu.org/archive/html/bug-bash> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <405e525c-278e-7779-3c39-3cf58d4bfa1a@noiraude.net> |
| X-Mailman-Original-References | <5d24be33.1c69fb81.59c43.fe4dSMTPIN_ADDED_BROKEN@mx.google.com> <a212b38c-914d-dda6-8d22-e9039063768e@case.edu> <6468b45e-5b4a-8edf-4ab8-0838843beaaf@noiraude.net> <b6f65b6b-1487-0c46-6530-fa6d700ff1ca@case.edu> <7c757690-24bd-7b1a-cf8e-af63cbe05216@noiraude.net> <91ed1981-df04-aa06-b108-23c7f89de3b4@case.edu> |
| Xref | csiph.com gnu.bash.bug:15147 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Le 12/07/2019 à 21:16, Chet Ramey écrivait : > On 7/12/19 12:46 PM, Léa Gris wrote: >> Le 09/07/2019 à 22:02, Chet Ramey écrivait : >> >>> These are up to the system's strtol/strtod. I don't know of too many >>> strtol implementations that use the thousands separator and numeric >>> grouping. >> >> Chet and you other Bash maintainers or contributors dudes: >> >> I can foresee the implications and blockages even lightly considering the >> possibility to align the Bash's built-in printf behavior with the %f >> argument with the sibling GNU Coreutils printf implementation. > > I don't think I explained this very well. For input, the printf builtin > relies on strtod(3) to parse the string into a floating point number. For > output, it relies on printf(3) to display a floating point number as a > string. I'm not really interested in re-implementing either one if the > system libc provides one that's perfectly acceptable. On POSIX-conformant > systems, those library functions generally honor the locale's decimal_point > character as the radix character. > > The `bc' you're using isn't POSIX conformant. > True, and fortunately this is exactly how I understood your detailed and informed explanations for how and why it is this way. By-the-way, as a user or as a Bash script writer, I am more concerned by the portability of the data a Bash script can handle. And for floating point numbers data, the one locale format I am sure to exist in any kind of the most lightly POSIX compliant systems, is the POSIX or C locale. If a bc is POSIX compliant, input and output numbers based on the locale, then I am almost fine with it. I can still set the locale to match the bc script number formats. It would be quite annoying having a bc script with numbers formatted to the da_DK locale that works only with a POSIX compliant bc command and only on systems with the da_DK locale available, but I am sure I can run any bc script that is using numbers formatted to the POSIX locale if I switch the local to POSIX before running the bc script. The issue with Bash's printf will spawn later down the line. When I need to output floating-point numbers the format of the user locale LC_NUMERIC, because human beings will read these numbers rather than another computer program. I will also have to provide Bash's printf with numbers of this locale format as parameters. I can not count on Bash's printf to bridge POSIX locale formatted floating-point numbers to any kind of user locale format. This is exactly here that my modest lcnumconv Bash library can help. Machine processing, and I count printf arguments as machine processing, is best done with POSIX locale formatted numbers. lcnumconv can also help deal with human input of floating-point numbers conversion to POSIX for processing these. Because Bash only know about strings and internally about integers. The built-in read can not translate floating point numbers to anything. It is just strings of characters. In this regard, printf support for floating point numbers is an alien ^^. -- Léa Gris
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: built-in printf %f parameter format depend on LC_NUMERIC Léa Gris <lea.gris@noiraude.net> - 2019-07-12 21:55 +0200
csiph-web