title: How to convert ansible string to float and use that value to compare with float value
body: <p>I want to convert <code>Ansible</code> <code>string</code> value to <code>float</code> and compare with another <code>float</code> value</p>
  
  <p>In my <code>ini</code> file <code>bin_version=6.5.17</code> I want to compare <code>bin_version</code> with 1 decimal value(6.5 >= 6.7) so I'm splitting it with 1 decimal value <code>bin_version.split('.')[:2]</code> and joining it with float 
  <code>"{{bin_version.split('.')[:2] | join('.')|float}}"</code></p>
  
  <p>But it's not working as expected with <code>when</code> condition <code>when: version &gt;= 6.7</code>, Does it float conversion(<code>|float</code>) really working here ?</p>
  
  <pre><code>tasks:
    - set_fact:
        version: "{{bin_version.split('.')[:2] | join('.')|float}}"
  
    - debug:
        msg: "{{version}}"
      when: version &gt;= 6.7
  </code></pre>
  
  <p><code>task</code> should be only executed when <code>version &gt;= 6.7</code></p>
  
  <p>But</p>
  
  <p>Case: 1: Pass</p>
  
  <pre><code>  when: version &gt;= 6.7 // 6.5 &gt;= 6.7
  </code></pre>
  
  <p>Expected result is task should be skipped but it's executing.</p>