The Wayback Machine - https://web.archive.org/web/20240623191039/https://www.geeksforgeeks.org/mathf-pow-method-in-c-sharp-with-examples/
Open In App

MathF.Pow() Method in C# with Examples

Last Updated : 04 Apr, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

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 this parameter is System.Single.
y: It is a single-precision floating-point number which specifies a power or exponent and type of this parameter is System.Single.

Return Type: The function returns the number base raised to the power. The return type of this method is System.Single

Example:




// C# program to illustrate the
// MathF.Pow(Single, Single) Method
using System;
  
class GFG {
  
    // Main Method
    static public void Main()
    {
  
        // Find power using MathF.Pow
        // 8 is base and 4 is power or
        // index or exponent of a number
        float pow_ab = MathF.Pow(8f, 4f);
  
        // Print the result
        Console.WriteLine(pow_ab);
  
        // 7.5 is base and 2 is power or
        // index or exponent of a number
        float pow_tt = MathF.Pow(7.5f, 2f);
  
        // Print the result
        Console.WriteLine(pow_tt);
  
        // 1234 is base and 7 is power or
        // index or exponent of a number
        float pow_t = MathF.Pow(1234f, 7f);
  
        // Print the result
        Console.WriteLine(pow_t);
    }
}


Output:

4096
56.25
4.357186E+21

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: This method will return the sine of x of type Syst
2 min read
MathF.Truncate() Method in C# with Examples
In C#, MathF.Truncate(Single) is a MathF class method which is used to compute an integral part of a specified single number or single-precision floating-point number.Syntax: public static float Truncate (float x); Parameter: x: It is the specified number which is to be truncated and type of this parameter is System.Single. Return Type: This method
1 min read
MathF.Exp() Method in C# with Examples
In C#, Exp(Single) is a MathF class method which is used to return the e raised to the specified power. Here e is a mathematical constant whose value is approximately 2.71828. Syntax: public static float Exp (float x); Here, x is the required number of type System.Single which specifies a power. Return Type: It returns a number e raised to the powe
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: // C# program to demonstrate the // MathF.Cbrt(Single) Method using System; class GFG { // Ma
2 min read
MathF.Atan() Method in C# with Examples
MathF.Atan(Single) Method is used to return the angle whose tangent is given as a single value argument. If the argument is NaN, then the result will be NaN. Syntax: public static float Atan (float x); Here, it takes a standard floating point number. Return Value: This method returns an angle Θ, measured in radians, its type is System.Single
2 min read
MathF.Sqrt() Method in C# with Examples
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 retu
2 min read
MathF.Ceiling() Method in C# with Examples
In C#, MathF.Ceiling(Single) is a MathF class method. This method is used to find the smallest integer , which is greater than or equal to the specified single or float value in the argument list. Syntax: public static float Ceiling (float x); Here, x is the float(Single) value whose ceiling value has to be calculated. Return Type: This method retu
1 min read
MathF.Cos() Method in C# with Examples
MathF.Cos(Single) is an inbuilt MathF class method which returns the cosine of a given float value argument(specified angle). Syntax: public static float Cos (float x); Here, x is the angle(measured in radian) whose cosine is to be returned and the type of this parameter is System.Single. Return Value: This method will return the cosine of x of typ
2 min read
MathF.Tan() Method in C# with Examples
MathF.Tan(Single) is an inbuilt MathF class method which returns the tangent of a given float value argument(specified angle). Syntax: public static float Tan (float x); Here, x is the angle(measured in radian) whose tangent is to be returned and the type of this parameter is System.Single. Return Value: This method will return the tangent of x 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: // C# program to demonstrate the // MathF.Abs(Single) Method using Syste
1 min read
three90RightbarBannerImg