Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Log

Returns the logarithm of a specified number in a specified base.
Read time 1 minuteLast updated 5 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule

Log(float, float)

Returns the logarithm of a specified number in a specified base.
public static float Log(float f, float p)

Parameters

Returns

Type

Description

float

Examples

using UnityEngine;public class ScriptExample : MonoBehaviour{ void Start() { // logarithm of 6 in base 2 // prints 2.584963 Debug.Log(Mathf.Log(6, 2)); }}

Log(float)

Returns the natural (base e) logarithm of a specified number.
public static float Log(float f)

Parameters

Returns

Type

Description

float

Examples

using UnityEngine;public class ScriptExample : MonoBehaviour{ void Start() { // natural logarithm of 100 // prints 4.60517 Debug.Log(Mathf.Log(100)); }}