title: Find two integers such that their product is close to a given real
body: <p>I'm looking for an algorithm to find two integer values <code>x,y</code> such that their product is as close as possible to a given double <code>k</code> while their difference is low.</p>
  
  <p><strong>Example</strong>: The area of a rectangle is <code>k=21.5</code> and I want to find the edges length of that rectangle with the constraint that they must be integer, in this case some of the possible solutions are (excluding permutations) <code>(x=4,y=5)</code>,<code>(x=3,y=7)</code> and the stupid solution <code>(x=21,y=1)</code></p>
  
  <p>In fact for the <code>(3,7)</code> couple we have the same difference as for the <code>(21,1)</code> couple</p>
  
  <p><code>21.5-3*7=0.5 = 21.5-21*1</code></p>
  
  <p>while for the <code>(4,5)</code> couple
  <code>21.5-4*5=1.5</code></p>
  
  <p>but the couple <code>(4,5)</code> is preferable because their difference is <code>1</code>, so the rectangle is "more squared".</p>
  
  <p>Is there a method to extract those <code>x,y</code> values for which the difference is minimal and the difference of their product to k is also minimal?</p>