title: Meaning of "%" operation in C# for the numeric type double
body: <p>Recently I discovered that C#'s operator <code>%</code> is applicable to double. Tried some things out, and after all came up with this test:</p>
  
  <pre><code>class Program
  {
      static void test(double a, double b)
      {
          if (a % b != a - b * Math.Truncate(a / b))
          {
              Console.WriteLine(a + ", " + b);
          }
      }
      static void Main(string[] args)
      {
          test(2.5, 7);
          test(-6.7, -3);
          test(8.7, 4);
          //...
      }
  }
  </code></pre>
  
  <p>Everything in this test works.
  Is <code>a % b</code> always equivalent to <code>a - b*Math.Round(a/b)</code>? If not, please explain to me how this operator really works.</p>
  
  <p>EDIT: Answering to James L, <strong>I understand that this is a modulo operator and everything. I'm curious only about how it works with double</strong>, integers I understand.</p>