bug-bash
[Top][All Lists]
Advanced

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

Re: About fltexpr


From: Chet Ramey
Subject: Re: About fltexpr
Date: Tue, 23 Sep 2025 14:39:35 -0400
User-agent: Mozilla Thunderbird

On 9/21/25 1:22 PM, pourko--- via Bug reports for the GNU Bourne Again SHell wrote:

A few things I noticed while I was playing with it:

$ echo ".1 + .2" | bc
.3
$ echo ".1 + .2" | fltexpr
-bash: fltexpr: expression expected

Correct; it is not bc and does not read from standard input.

$ fltexpr -p ".1 + .2"
-bash: fltexpr: .1 + .2: arithmetic syntax error: operand expected (error token is 
".1 + .2")

Its heritage as a modification of `let' peeking out there.

$ fltexpr -p "0.1 + 0.2"
0.30000000000000004

That is the minimal representation that will survive a round-trip from
double to string to double. Look at fltexpr.c:fltexpr_format().

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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