เมธอด MathF.Exp() ใน C# ส่งคืนค่า e ยกกำลังของตัวเลขที่ระบุ (e^x)
ไวยากรณ์
public static float Exp (float val);
พารามิเตอร์ val คือจำนวนจุดทศนิยมที่เป็นเลขชี้กำลัง
ตัวอย่าง
using System;
class Demo {
public static void Main(){
float val = 90f;
float res = MathF.Exp(val);
Console.WriteLine("MathF.Exp() = " + res);
}
}ผลลัพธ์
MathF.Exp() = Infinity
ตัวอย่างที่ 2
using System;
class Demo {
public static void Main(){
float val = 0.00f;
float res = MathF.Exp(val);
Console.WriteLine("MathF.Exp() = " + res);
}
}ผลลัพธ์
MathF.Exp() = 1