On Mon, Sep 22, 2025 at 03:06:51AM +0200, [email protected] wrote: > On Mon, 22 Sep 2025 10:49:03 +1000 Duncan Roe wrote: > > Indeed. I was thinking about a previous post where someone suggested printf, > > which could round the answer to less digits. That's what you want isn't it? > > There's printf in Bash, and there's printf in C. Why would I have to do > it in Bash, when the correct output can come directly from the C program? > > Besides, I can't readily clean up the trailing zeros with printf, I will > still have to do some extra juggling on top of that, to get the answer "0.3". > > And no, I can't simply tell printf to print me only one digit after the dot, > because I don't know beforehand how many digits the answer will have. > > $ printf '%g\n' $(fltexpr -p '0.1 + 0.2') 0.3
Re: About fltexpr
Duncan Roe via Bug reports for the GNU Bourne Again SHell Sun, 21 Sep 2025 20:25:26 -0700
- Re: About fltexp... Lawrence Velázquez
- Re: About f... pourko--- via Bug reports for the GNU Bourne Again SHell
- Re: Abo... Duncan Roe via Bug reports for the GNU Bourne Again SHell
- Re: About fltexp... pourko--- via Bug reports for the GNU Bourne Again SHell
- Re: About f... Oğuz
- Re: Abo... pourko--- via Bug reports for the GNU Bourne Again SHell
- Re:... Duncan Roe via Bug reports for the GNU Bourne Again SHell
- Re: About f... Andreas Schwab
- Re: About fltexp... pourko--- via Bug reports for the GNU Bourne Again SHell
- Re: About f... Lawrence Velázquez
- Re: Abo... pourko--- via Bug reports for the GNU Bourne Again SHell
