title: How to properly handle comparison between double values in Swift?
body: <p>I know similar question has been asked but I still could not figured out the solution.</p>
  
  <p>I am getting double value like this.</p>
  
  <pre><code>let priceUsdInt = (price as NSString).doubleValue
  </code></pre>
  
  <p>And I want to compare this value to 1.00 so:</p>
  
  <pre><code>if priceUsdInt &gt; 1.00 {
      let priceUsdCur = priceUsdInt.currencyUS
      finalPriceUsdCur = priceUsdCur
  } else {
      let priceUsdCur = priceUsdInt.currencyUS6
      finalPriceUsdCur = priceUsdCur
  }
  </code></pre>
  
  <p>This always bring two decimal results. Even-though value is way lower then 1.00.</p>
  
  <p>Basically, what I want to achieve is if value is lesser then 1.00 then show it until six decimals i.e. 0.123456 when converted to currency format, if not show only two decimals after it i.e. 1.23.</p>
  
  <p>Thank you for your time.</p>