Double - Abs

Returns the absolute value of a double-precision floating-point number.

Try it

public static void Main()
{
	double[] doubles = { Double.MaxValue, 16.354e-17, 15.098123, 0, 
                       -19.069713, -15.058e18, Double.MinValue };
	
  	foreach (double value in doubles)
	{
		// C# Extension Method: Double - Abs
    	Console.WriteLine("Abs({0}) = {1}", value, value.Abs());
	}
}

View Source
using System;

public static partial class Extensions
{
    /// <summary>
    ///     Returns the absolute value of a double-precision floating-point number.
    /// </summary>
    /// <param name="value">A number that is greater than or equal to , but less than or equal to .</param>
    /// <returns>A double-precision floating-point number, x, such that 0 ? x ?.</returns>
    public static Double Abs(this Double value)
    {
        return Math.Abs(value);
    }
}