Difference between revisions of "Log - Math"

From the CreationKit Wiki
Jump to navigation Jump to search
Line 19: Line 19:
== Examples ==
== Examples ==
<source lang="papyrus">
<source lang="papyrus">
float lnNum = Math.Log(5,89) ; lnNum ≈ 1,773256
float lnNum = Math.Log(5.89) ; lnNum ≈ 1.773256
</source>
</source>


<source lang="papyrus">
<source lang="papyrus">
; there's no function that returns simple logarithm, but you can get it yourself
; there's no function that returns simple logarithm, but you can get it yourself
; log(2.71828) = 0,434294 (Euler's number = 2.71828)
; 0.434294 = lofarithm of Euler's number (2.71828)


float logNum = (Math.Log(5,89)) * 0,434294 ; logNum ≈ 0,770114 (keep in mind, the result is not completely accurate)
float logNum = (Math.Log(5.89)) * 0.434294 ; logNum ≈ 0.770114 (keep in mind, the result is not completely accurate)
</source>
</source>



Revision as of 15:36, 13 July 2023

SKSE Member of: Math Script

Returns natural logarithm of passed argument as float value.

Syntax

float Function Log(float arg1) global native

Parameters

  • arg1: The float value to calculate natural logarithm from.

Return Value

The natural logarithm of arg1.

Examples

float lnNum = Math.Log(5.89) ; lnNum ≈ 1.773256
; there's no function that returns simple logarithm, but you can get it yourself
; 0.434294 = lofarithm of Euler's number (2.71828)

float logNum = (Math.Log(5.89)) * 0.434294 ; logNum ≈ 0.770114 (keep in mind, the result is not completely accurate)

Notes

See Also