Double - Floor
Returns the largest integer less than or equal to the specified double-precision floating-point number.
public static void Main() { double[] values = { 7.03, 7.64, 0.12, -0.12, -7.1, -7.6 }; Console.WriteLine(" Value Floor\n"); foreach (double value in values) { // C# Extension Method: Double - Floor Console.WriteLine("{0,7} {1,16}", value, value.Floor()); } }
View Source
using System; public static partial class Extensions { /// <summary> /// Returns the largest integer less than or equal to the specified double-precision floating-point number. /// </summary> /// <param name="d">A double-precision floating-point number.</param> /// <returns>The largest integer less than or equal to . If is equal to , , or , that value is returned.</returns> public static Double Floor(this Double d) { return Math.Floor(d); } }