2 using System.Collections.Generic;
10 public static class DoubleExtensions
18 public static double Limit(
this double d,
double MinValue,
double MaxValue)
20 if (d < MinValue)
return MinValue;
21 if (d > MaxValue)
return MaxValue;
33 public static bool IsBetween(
this double i,
double MinValue,
double MaxValue)
35 return (i >= MinValue && i <= MaxValue);
45 public static double Round(
this double d)
47 return Math.Round(d, 0);
55 public static int RoundToInt(
this double d)
57 return (
int)Math.Round(d, 0);
66 public static double Round(
this double d,
int Digits)
68 return Math.Round(d, Digits.Limit(0, 15));
76 public static double Abs(
this double d)
86 public static double Floor(
this double d)
97 public static double Ceiling(
this double d)
99 return Math.Ceiling(d);
109 public static bool IsIntegral(
this double d)
111 return d == Math.Floor(d);