title: Using round() function in c
body: <p>I'm a bit confused about the <code>round()</code> function in C.</p>
  
  <p>First of all, man says:</p>
  
  <pre><code>SYNOPSIS
     #include &lt;math.h&gt;
     double round(double x);
  
  RETURN VALUE
     These functions return the rounded integer value.
     If x is integral, +0, -0, NaN, or infinite, x itself is returned.
  </code></pre>
  
  <p>The return value is a <code>double</code> / <code>float</code> or an <code>int</code>?</p>
  
  <p>In second place, I've created a function that first rounds, then casts to int. Latter on my code I use it as a mean to <em>compare doubles</em></p>
  
  <pre><code>int tointn(double in,int n)
  {
      int i = 0;
      i = (int)round(in*pow(10,n));
      return i;
  }
  </code></pre>
  
  <p>This function apparently isn't stable throughout my tests. Is there redundancy here? Well... I'm not looking only for an answer, but a better understanding on the subject.</p>