12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using System;
- namespace wf
- {
- public static class Math
- {
- public static int Round2(int num)
- {
- return Math.Min(Math.Max(num, 0), 99);
- }
- public static int Round3(int num)
- {
- return Math.Min(Math.Max(num, 0), 999);
- }
- public static int Round4(int num)
- {
- return Math.Min(Math.Max(num, 0), 9999);
- }
- public static int Round5(int num)
- {
- return Math.Min(Math.Max(num, 0), 99999);
- }
- public static long Round4(long num)
- {
- return Math.Min(Math.Max(num, 0L), 9999L);
- }
- public static long Round6(long num)
- {
- return Math.Min(Math.Max(num, 0L), 999999L);
- }
- public static int RoundMinMax(int num, int min, int max)
- {
- return Math.Min(Math.Max(num, min), max);
- }
- public static float RoundMinMax(float num, float min, float max)
- {
- return Math.Min(Math.Max(num, min), max);
- }
- public static long RoundMinMax(long num, long min, long max)
- {
- return Math.Min(Math.Max(num, min), max);
- }
- }
- }
|