title: Round to multiple of a number
body: <p>I'm trying to create a function that rounds a number to the nearest multiple of a given number as integer.</p>
  
  <p>So if the number is 15 we have</p>
  
  <ul>
  <li>14,4 rounds to 15</li>
  <li>-14,4 rounds to -15</li>
  <li>14,5 rounds to 15 </li>
  <li>28  rounds to 30</li>
  <li>-28 rounds to -30</li>
  </ul>
  
  <p>and so on. I have already in place some code but seems to not work as expected:</p>
  
  <pre><code>public static int RoundToFactor(float number, float Factor)
  {
          int returnNumber;
  
          if((number%Factor) == 0) {
              returnNumber = (int)number;
          }
  
          returnNumber = (int) (Mathf.Round(number/Factor)*Factor);
  
          return returnNumber;
  }
  </code></pre>