title: C++ Sgn Function
body: <p>I saw the function below that should return sign of double d. But I couldn't understand how it works?</p>
  
  <pre><code>int sgn(double d){ 
      return d&lt;-eps?-1:d&gt;eps;
  }
  </code></pre>