bug-bash
[Top][All Lists]
Advanced

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

About fltexpr


From: pourko
Subject: About fltexpr
Date: Sun, 21 Sep 2025 19:22:18 +0200 (CEST)

I am excited about the new fltexpr loadable. It looks like 
it is still a work in progress, and can use some polishing.
It is nice though!

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

$ echo ".1 + .2" | bc
.3
$ echo ".1 + .2" | fltexpr
-bash: fltexpr: expression expected
$ fltexpr -p ".1 + .2"
-bash: fltexpr: .1 + .2: arithmetic syntax error: operand expected (error token 
is ".1 + .2")
$ fltexpr -p "0.1 + 0.2"
0.30000000000000004

---

$ fltexpr -p "9.93 + 0.17"
10.1
$ fltexpr -p "10.1 - 9.93"
0.16999999999999993

---

Also, it would be really cool if fltexpr leaves the result in 
var FLTEXPR, or at least if it takes an option "-v VAR", the 
way printf does, so we won't have to do command substitutions.

And, maybe some mention in --help about the functions it supports?
$ fltexpr -p "PI"
3.141592653589793
$ fltexpr -p "sin(1)"
0.8414709848078965
$ fltexpr -p "fmax(-3.4,-5.7)"
-3.4
$ fltexpr -p "sqrt(2)"
1.4142135623730951

Thank you!

--
Pourko




reply via email to

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