0

I am looking for bash function suitable to do some simple arithmetic expressions on point values For intance

i=1
let "i_mod=${i}+1"; echo $i_mod
gives me 2

but if i=1.0 let "i_mod=${i}+0.5";echo $i_mod gives me an error instead of 1.5

or alternatively one of the sollution that has already been suggested in other topic:

i=1.0
echo "$(($i+1.0))"
-bash: 1.0+1.0: syntax error: invalid arithmetic operator (error token is ".0+1.0")

0 Answers0