REQUEST - bash floating point math support

2024-06-05 Thread Zachary Santer
On Tue, Jun 4, 2024 at 4:01 PM Saint Michael wrote: > > > > > It's time to add floating point variables and math to bash. > > It just makes so much easier to solve business problems without external > calls to bc or Python. > Please let's overcome the "shell complex". Let's treat bash a real langu

Re: REQUEST - bash floating point math support

2024-06-05 Thread Robert Elz
Date:Wed, 5 Jun 2024 08:40:51 -0400 From:Zachary Santer Message-ID: | The magnification factor is handled as a | fractional number - 1.5, 1.75, etc. So, to change the magnification | factor by increments of 0.25 or 0.5, I had to print an expression into | b

Re: REQUEST - bash floating point math support

2024-06-05 Thread Greg Wooledge
On Wed, Jun 05, 2024 at 09:57:26PM +0700, Robert Elz wrote: > Also note that to actually put floating support in the shell, more is > needed than just arithmetic, you also need floating comparisons in test > (or in bash, in [[ ) and a whole bunch more odds and ends that aren't > obvious until you n

Re: REQUEST - bash floating point math support

2024-06-05 Thread Koichi Murase
2024年6月5日(水) 21:41 Zachary Santer : > Bash could potentially detect floating point literals within > arithmetic expansions and adjust the operations to use floating point > math in that case. [...] ksh and zsh are already behaving in that way, and if Bash would support the floating-point arithmeti

Re: REQUEST - bash floating point math support

2024-06-05 Thread Robert Elz
Date:Wed, 5 Jun 2024 11:09:45 -0400 From:Greg Wooledge Message-ID: | > to convert floats back into integers again, controlling how | > rounding happens). | | Ironically, that last one is the one we already *do* have. Yes, I know about printf (and while POSIX

Setting HISTTIMEFORMAT is causing problems in >=bash-5.2

2024-06-05 Thread Thomas Deutschmann
Hello! I would like to report an issue with bash version >=5.2. For years, I have had the following line in my ~/.bashrc: export HISTTIMEFORMAT="[$(tput setaf 6)%F %T$(tput sgr0)]: " # colorful date This worked perfectly up to and including bash version 5.1.0(16). However, since bash versio

Re: REQUEST - bash floating point math support

2024-06-05 Thread Saint Michael
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 The

Re: REQUEST - bash floating point math support

2024-06-05 Thread Greg Wooledge
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

Re: REQUEST - bash floating point math support

2024-06-05 Thread Saint Michael
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 wrote: > On Wed, Jun 05, 2024 at 01:31:20PM -0400, Saint Michael wro

Re: REQUEST - bash floating point math support

2024-06-05 Thread Robert Elz
Date:Wed, 5 Jun 2024 13:31:20 -0400 From:Saint Michael Message-ID: | 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 In addition to what Greg suggested, for the very

Re: REQUEST - bash floating point math support

2024-06-05 Thread Léa Gris
Le 05/06/2024 à 17:09, Koichi Murase écrivait : 2024年6月5日(水) 21:41 Zachary Santer : Bash could potentially detect floating point literals within arithmetic expansions and adjust the operations to use floating point math in that case. [...] ksh and zsh are already behaving in that way, and if B