I think that we should do this in the shell. I mean. It will get done at
some point, in the next decades or centuries. Why not do it now? Let's
compile some C library or allow inline C

On Wed, Jun 5, 2024, 2:12 PM Greg Wooledge <g...@wooledge.org> wrote:

> On Wed, Jun 05, 2024 at 01:31:20PM -0400, Saint Michael wrote:
> > the most obvious use of floating variables would be to compare
> > balances and to branch based on if a balance is lower than a certain
> > value
> > I use:
> > t=$(python3 -c "import math;print($balance > 0)")
> > and the
> > if [ "$t" == "False" ];then
> > echo "Result <= 0 [$t] Client $clname $clid Balance $balance"
> > fi
> > There must be a solution without Awk or Python or BC. Internal to bash
>
> The example you show is just comparing to 0, which is trivial.  If
> the $balance variable begins with "-" then it's negative.  If it's "0"
> then it's zero.  Otherwise it's positive.
>
> For comparing two arbitrary variables which contain strings representing
> floating point numbers, you're correct -- awk or bc would be the minimal
> solution.
>
>

Reply via email to