MathF.Sqrt() Method in C# with Examples Last Updated : 04 Apr, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report In C#, MathF.Sqrt(Single) is a MathF class(present in system namespace) method which is used to calculate the square root of the specified Single or float data type value. Syntax: public static float Sqrt (float x); Here, x is the number whose square root is to be calculated and type of this parameter is System.Single. Return Type: This method returns the square root of x. If x is equal to NaN, NegativeInfinity, or PositiveInfinity, that value is returned. The return type of this method is System.Single. Below are the examples to illustrate the use of the above-discussed method: Example 1: csharp // C# program to demonstrate the // MathF.Sqrt(Single) Method using System; class GFG { // Main Method public static void Main() { // taking positive value float x = 78521F; // taking negative value float x1 = -7824F; // Input positive value // Output will be square // root of x Console.WriteLine(MathF.Sqrt(x)); // Input negative value, // Output will be NaN Console.Write(MathF.Sqrt(x1)); } } Output: 280.216 NaN Example 2: csharp // C# program to demonstrate the MathF.Sqrt() // method when the argument is positive // or negative Zero using System; class GFG { // Main Method public static void Main() { // taking positive zero float x = 0f; Console.WriteLine(MathF.Sqrt(x)); // taking negative zero float y = -0f; Console.Write(MathF.Sqrt(y)); } } Output: 0 0 Comment More infoAdvertise with us Next Article MathF.Sqrt() Method in C# with Examples K Kirti_Mangal Follow Improve Article Tags : C# CSharp-method CSharp-MathF-Class Similar Reads MathF.Sin() Method in C# with Examples MathF.Sin(Single) is an inbuilt MathF class method which returns the sine of a given float value argument(specified angle). Syntax: public static float Sin (float x); Here, x is the angle(measured in radian) whose sine is to be returned and the type of this parameter is System.Single. Return Value: 2 min read MathF.Pow() Method in C# with Examples In C#, MathF.Pow(Single, Single) is a MathF class method. This method is used to calculate a number raise to the power of some other number. Syntax: public static float Pow (float x, float y); Parameters: x: It is a single-precision floating-point number which is to be raised to a power and type of 2 min read MathF.Abs() Method in C# with Examples MathF.Abs(Single) Method is used to return the absolute value of a specified float number. Syntax: public static float Abs (float x); Here, it takes a standard floating point number. Return Value: This method returns a floating point value less than Single.MaxValue. Example 1: csharp // C# program t 1 min read MathF.Cbrt() Method in C# with Examples MathF.Cbrt(Single) Method is used to return the cube root of a floating point value. Syntax: public static float Cbrt (float x); Here, it takes a standard floating point number. Return Value: This method returns the cube root of the given value. Example 1: csharp // C# program to demonstrate the // 2 min read MathF.Round() Method in C# with Examples | Set - 1 In C#, MathF.Round() is a MathF class method which is used to round a value to the nearest integer or to the particular number of fractional digits. This method can be overloaded by changing the number and type of arguments passed. There are 4 methods in the overload list of the MathF.Round() method 3 min read Like