Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Exp(float)

Returns the result of raising euler's number (e) to the power power.
Read time 1 minuteLast updated 4 days ago

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)); }}