Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> C#

Phương thức MathF.Exp() trong C#

Phương thức MathF.Exp() trong C# trả về giá trị e mũ lũy thừa của số chỉ định.

Cú pháp

public static float Exp (float val);

Tham số val là số float.

Ví dụ

using System; 
class Demo { 
    public static void Main(){ 
        float val = 90f; 
        float res = MathF.Exp(val); 
        Console.WriteLine("MathF.Exp() = " + res); 
    } 
}

Kết quả

MathF.Exp() = Infinity

Ví dụ khác

using System; 
class Demo { 
    public static void Main(){ 
        float val = 0.00f; 
        float res = MathF.Exp(val); 
        Console.WriteLine("MathF.Exp() = " + res); 
    } 
}

Kết quả

MathF.Exp() = 1