title: How can I compare two floating point numbers in Bash?
body: <p>I am trying hard to compare two floating point numbers within a Bash script. I have two variables, e.g.</p>
  <pre><code>let num1=3.17648e-22
  let num2=1.5
  </code></pre>
  <p>Now, I just want do a simple comparison of these two numbers:</p>
  <pre><code>st=`echo &quot;$num1 &lt; $num2&quot; | bc`
  if [ $st -eq 1]; then
    echo -e &quot;$num1 &lt; $num2&quot;
  else
    echo -e &quot;$num1 &gt;= $num2&quot;
  fi
  </code></pre>
  <p>Unfortunately, I have some problems with the right treatment of the num1 which can be of the &quot;e-format&quot;.</p>