Returns the square root of the specified double.
- d
- A double .
A double whose value is indicated as follows:
Condition Returns d >= 0 A double containing the positive square root of d. d < 0
d is equal to double.NegativeInfinity.
d is equal to double.NaN.
double.NaN. d is equal to double.PositiveInfinity
Documentation for this section has not yet been entered.
The following example demonstrates using the Math.Sqrt(double) method.
C# Example
using System; public class MathSqrtExample { public static void Main() { Double d1 = Math.Sqrt(16.0); Double d2 = Math.Sqrt(0.0); Double d3 = Math.Sqrt(-10.0); Console.WriteLine("Math.Sqrt(16.0) returns {0}", d1); Console.WriteLine("Math.Sqrt(0.0) returns {0}", d2); Console.WriteLine("Math.Sqrt(-10.0) returns {0}", d3); } }The output is
Math.Sqrt(16.0) returns 4
Math.Sqrt(0.0) returns 0
Math.Sqrt(-10.0) returns NaN
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0