title: Swift get Fraction of Float
body: <p>I've been trying out swift lately and i've come across a rather simple Problem.</p>
  
  <p>In Obj-C when i want to get the fraction digits of a float i'd do the following:</p>
  
  <pre><code>float x = 3.141516
  int integer_x = (int)x;
  float fractional_x = x-integer_x;
  //Result: fractional_x = 0.141516
  </code></pre>
  
  <p>in Swift:</p>
  
  <pre><code>let x:Float = 3.141516
  let integerX:Int = Int(x)
  let fractionalX:Float =  x - integerX 
  </code></pre>
  
  <p>-> this results in an error because of mismachting types</p>
  
  <p>Any Idea how to do it correctly?</p>
  
  <p>Thanks in Advance</p>
  
  <p>Malte</p>