Unofficial LSL Reference

[[functions:llpow]]


Unofficial LSL reference

User Tools

Login

You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.

Login

Forgotten your password? Get a new one: Set new password

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

functions:llpow [2014-05-16 08:55 SLT]
sei created
functions:llpow [2015-02-04 13:15 SLT] (current)
sei caveat: no Euler constant
Line 1: Line 1:
 +$nav
 ===== Function: llPow ===== ===== Function: llPow =====
  
Line 17: Line 18:
 ===== Return value ===== ===== Return value =====
  
-The result of raising ​''​base'' ​to ''​exp''​.+The result of raising ​$prm[baseto the power $prm[exp].
  
 ===== Notes ===== ===== Notes =====
  
-  * If the base is negative, the exponent ​must have no decimals (i.erepresent ​an integer ​number); otherwise, **NaN** is returned+  ​* There is no function to return $econst<​sup>​x</​sup>​ given //x,// and no built-in constant for $econst. Use ''​llPow(2.7182818,​ value)''​ instead. 
-  * If both base and exponent ​are zero, the result is 1.0. + 
-  * If either argument ​is **NaN**, the result is **NaN**.+The rules for corner cases are somewhat convoluted. In order: 
 + 
 +  * If either argument is $nan, the result is $nan. 
 +  * If the exponent is 0.0 or -0.0, the result is 1.0. This includes in particular the bases 0.0, $pinf, and $minf. 
 +  ​* If the base is $pinf or $minfand the exponent ​is negative, the result is 0.0. 
 +  * If the base is $minf and the exponent is positive and represents ​an odd integer, ​the result is $minf. 
 +  ​If the base is $pinf or $minf and the exponent is positive, the result is $pinf (except in those cases which meet the previous point'​s condition). 
 +  ​If the base is -0.0, and the exponent is negative and represents an odd integer, the result is $minf
 +  * If the base is 0.0 or -0.0, and the exponent ​is negative, the result ​is $pinf (except in those cases which meet the previous point'​s condition). 
 +  * If the base is 1.0 or -1.0, and the exponent is $pinf or $minf, the result is $nan
 +  * If the base is negative, the exponent must have no decimals (i.e. represent an integer number); otherwise, $nan is returned. 
 +  ​In all other cases, the expected ​result ​(the base raised to the exponent) ​is returned.
  
 ===== Short examples ===== ===== Short examples =====
Line 41: Line 53:
 ===== See also ===== ===== See also =====
  
-  * [[llLog]] calculates the natural logarithm of the input. +  * $lfn[llLog] calculates the natural logarithm of the input. 
-  * [[llLog10]] calculates the logarithm in base 10 of the input.+  * $lfn[llLog10] calculates the logarithm in base 10 of the input
 +  * $lty[float] type and associated caveats and limitations.