[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: REQUEST - bash floating point math support
From: |
Greg Wooledge |
Subject: |
Re: REQUEST - bash floating point math support |
Date: |
Wed, 5 Jun 2024 11:09:45 -0400 |
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 need them, and they're just not there (like a mechanism
> to convert floats back into integers again, controlling how rounding happens).
Ironically, that last one is the one we already *do* have.
hobbit:~$ printf '%.0f\n' 11.5 22.5 33.5
12
22
34
As long as you're OK with "banker's rounding", printf does it.
- Re: REQUEST - bash floating point math support, (continued)
- Re: REQUEST - bash floating point math support, Léa Gris, 2024/06/17
- Re: REQUEST - bash floating point math support, Zachary Santer, 2024/06/17
- Re: REQUEST - bash floating point math support, Chet Ramey, 2024/06/21
- Re: REQUEST - bash floating point math support, alex xmb sw ratchev, 2024/06/21
- Re: REQUEST - bash floating point math support, Chet Ramey, 2024/06/21
- Re: REQUEST - bash floating point math support, Saint Michael, 2024/06/21
- Re: REQUEST - bash floating point math support, alex xmb sw ratchev, 2024/06/21
- Re: REQUEST - bash floating point math support, Chet Ramey, 2024/06/21
- Re: REQUEST - bash floating point math support, Chet Ramey, 2024/06/12
- Re: REQUEST - bash floating point math support, Robert Elz, 2024/06/05
- Re: REQUEST - bash floating point math support,
Greg Wooledge <=
- Re: REQUEST - bash floating point math support, Léa Gris, 2024/06/06
- Re: REQUEST - bash floating point math support, Robert Elz, 2024/06/05
- Re: REQUEST - bash floating point math support, Saint Michael, 2024/06/05
- Re: REQUEST - bash floating point math support, Greg Wooledge, 2024/06/05
- Re: REQUEST - bash floating point math support, Saint Michael, 2024/06/05
- Re: REQUEST - bash floating point math support, Robert Elz, 2024/06/05
- Re: REQUEST - bash floating point math support, Zachary Santer, 2024/06/06