title: objective C cosine
body: <p>I'm just facing weird problem with cos function in objective c. I have the xcode 4.1.1 with iOS 4.3 SDK installed.</p>
  
  <p>I'm calculating the cos of a number:</p>
  
  <pre><code>y= cos(x*M_PI/180)
  </code></pre>
  
  <p>this returns correct answer for almost all numbers except for 90 degree.</p>
  
  <pre><code>y=cos(90*M_PI/180)
  </code></pre>
  
  <p>y is 6.12323e-17! which is not correct. it should be 0.</p>
  
  <p>the NSLog shows something different:</p>
  
  <pre><code>operand=cos(operand * M_PI / 180);
  NSLog(@"cos: %d", operand);
  </code></pre>
  
  <p>result:
      cos: -832086752</p>
  
  <p>I don't get. Can someone explain it please?</p>