Cosmos/source/Cosmos.System2/MathEx.cs
2020-06-17 21:01:15 +03:00

26 lines
643 B
C#

using System;
namespace Cosmos.System
{
/// <summary>
/// MathEx class. Provides additional math methods.
/// </summary>
public static class MathEx
{
/// <summary>
/// Get the remainder on division of a in b.
/// </summary>
/// <param name="a">Divided number.</param>
/// <param name="b">Divider.</param>
/// <returns>long value.</returns>
public static long Rem(long a, long b)
{
long result = a;
while (result - b > 0)
{
result = result - b;
}
return result;
}
}
}