文档

Unity Engine

Unity Engine

Exp(float)

Returns the result of raising euler's number (e) to the power power.
阅读时间1 分钟最后更新于 1 个月前

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public static float Exp(float power)

Parameters

power

Exponent of the exponentiation operation.

Returns

Type

Description

floatResult of the exponentiation operation.

Remarks

The result of this function is the same as the result of 'Mathf.Pow(e, power)', with e being Euler's number (2.718282).
Additional Resources: Mathf.Pow.

Examples

using UnityEngine;public class Example : MonoBehaviour{ void Start() { // Prints Infinity Debug.Log(Mathf.Exp(Mathf.Infinity)); // Prints 2.718282 Debug.Log(Mathf.Exp(1)); // Prints 1 Debug.Log(Mathf.Exp(0)); // Prints 0 Debug.Log(Mathf.Exp(-Mathf.Infinity)); }}