Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/bin/sleep
On Fri, Jan 25, 2019 at 20:59:56 +0700, Robert Elz wrote:
> What other commands take floating point args on the command line
> (aside from awk assignments to vars, which are certainly intended to
> be locale specific) I'm not sure I can think of one.
I think printf(1) comes closest.
http://pubs.opengroup.org/onlinepubs/7908799/xcu/printf.html
The argument operands [...] will be evaluated as a C constant, as
described by the ISO C standard, with the following extensions:
- A leading plus or minus sign will be allowed.
- If the leading character is a single- or double-quote, the value
will be the numeric value in the underlying codeset of the
character following the single- or double-quote.
Linux:
$ LC_NUMERIC=C /usr/bin/printf '%f\n' 3.14
3.140000
$ LC_NUMERIC=C /usr/bin/printf '%f\n' 3,14
/usr/bin/printf: '3,14': value not completely converted
3.000000
$ LC_NUMERIC=ru_RU.UTF-8 /usr/bin/printf '%f\n' 3.14
3,140000
$ LC_NUMERIC=ru_RU.UTF-8 /usr/bin/printf '%f\n' 3,14
/usr/bin/printf: '3,141': value not completely converted
3,000000
NetBSD:
$ LC_NUMERIC=C /usr/bin/printf '%f\n' 3.14
3.140000
$ LC_NUMERIC=C /usr/bin/printf '%f\n' 3,14
printf: 3,14: not completely converted
3.000000
$ LC_NUMERIC=ru_RU.UTF-8 /usr/bin/printf '%f\n' 3.14
printf: 3.14: not completely converted
3,000000
$ LC_NUMERIC=ru_RU.UTF-8 /usr/bin/printf '%f\n' 3,14
3,140000
So NetBSD printf has the same problem.
-uwe
Home |
Main Index |
Thread Index |
Old Index