bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: REQUEST - bash floating point math support


From: Martin D Kealey
Subject: Re: REQUEST - bash floating point math support
Date: Fri, 14 Jun 2024 13:41:34 +1200

On Thu, 13 Jun 2024 at 09:05, Zachary Santer <zsanter@gmail.com> wrote:

>
> Let's say, if var is in the form of a C floating-point literal,
> ${var@F} would expand it to the locale-dependent formatted number, for
> use as an argument to printf or for output directly. And then ${var@f}
> would go the other way, taking var that's in the form of a
> locale-dependent formatted number, and expanding it to a C
> floating-point literal.
>

How about incorporating the % printf formatter directly, like ${var@%f} for
the locale-independent format and %{var@%#f} for the locale-specific format?

However any formatting done as part of the expansion assumes that the
variable holds a "number" in some fixed format, rather than a localized
string.
Personally I think this would actually be a good idea, but it would be
quite a lot bigger project than simply added FP support.

-Martin


reply via email to

[Prev in Thread] Current Thread [Next in Thread]