I am trying hard to compare two floating point numbers within a bash script. I have to variables, e.g.
let num1=3.17648e-22 let num2=1.5
No
bash handles only integer maths but you can use bc command as follows:
bc
$ num1=3.17648E-22 $ num2=1.5 $ echo $num1'>'$num2 | bc -l 0 $ echo $num2'>'$num1 | bc -l 1
Note that exponent sign must be uppercase