2 using System.Collections.Generic;
10 public static class floatExtensions
18 public static float Limit(
this float d,
float MinValue,
float MaxValue)
20 if (d < MinValue)
return MinValue;
21 if (d > MaxValue)
return MaxValue;
32 public static bool IsBetween(
this float i,
float MinValue,
float MaxValue)
34 return (i >= MinValue && i <= MaxValue);
42 public static float Round(
this float d)
44 return (
float)Math.Round(d, 0);
53 public static float Round(
this float d,
int Digits)
55 return (
float)Math.Round(d, Digits.Limit(0,15));
63 public static int RoundToInt(
this float d)
65 return (
int)Math.Round(d, 0);
73 public static float Abs(
this float d)
83 public static float Floor(
this float d)
85 return (
float)Math.Floor(d);
94 public static float Ceiling(
this float d)
96 return (
float)Math.Ceiling(d);
106 public static bool IsIntegral(
this float d)
108 return d == Math.Floor(d);