title: Why is modulus operator not working for double in c#?
body: <p>Consider this:</p>
  
  <pre><code>double x,y;
  x =120.0;
  y = 0.05;
  
  double z= x % y;
  </code></pre>
  
  <p>I tried this and expected the result to be 0, but it came out 0.04933333.</p>
  
  <p>However,</p>
  
  <pre><code>x =120.0;
  y = 0.5;
  double z= x % y;
  </code></pre>
  
  <p>did indeed gave the correct result of 0.</p>
  
  <p>What is happening here?</p>
  
  <p>I tried <code>Math.IEEERemainder(double, double)</code> but it's not returning 0 either. What is going on here?</p>
  
  <p>Also, as an aside, what is the most appropriate way to find remainder in C#?</p>