Difference between revisions of "SHIP:Sail:pow"

From Serious Documentation
Jump to: navigation, search
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
{{SailFuncTableStart|}}<onlyinclude>
 
{{SailFuncTableStart|}}<onlyinclude>
|{{SailFunc|sqrt}}||{{DataType|Float}}||style="text-align:center;"|v5.1.0||Return the square root of the given number{{v5}}</onlyinclude>
+
|{{SailFunc|pow}}||{{DataType|Float}}||style="text-align:center;"|v5.1.0||Calculates x to the power of y (x^y)</onlyinclude>
 
|}
 
|}
 
== See Also: ==
 
== See Also: ==
Line 9: Line 9:
 
*{{SailFunc|abs}}, {{SailFunc|exp}}, {{SailFunc|expm1}}, {{SailFunc|ftoi}}, {{SailFunc|itof}}, {{SailFunc|max}}, {{SailFunc|min}}
 
*{{SailFunc|abs}}, {{SailFunc|exp}}, {{SailFunc|expm1}}, {{SailFunc|ftoi}}, {{SailFunc|itof}}, {{SailFunc|max}}, {{SailFunc|min}}
 
== Prototype ==
 
== Prototype ==
<code>{{DataType|Float}} {{SailFunc|sqrt}}({{DataType|Integer}} n);</code>
+
<code>{{DataType|Float}} {{SailFunc|pow}}({{DataType|Float}}/{{DataType|Integer}} x, {{DataType|Integer}} y);</code>
  
 
== Parameters/Return Value ==
 
== Parameters/Return Value ==
Line 17: Line 17:
 
! scope="col" style="text-align:left" | Description
 
! scope="col" style="text-align:left" | Description
 
|-
 
|-
|n||{{DataType|Integer}}||the number to take the suqare root of
+
|x||{{DataType|Integer}}||the base number
 +
|-
 +
|y||{{DataType|Integer}}||the power value
 
|-
 
|-
 
! scope="col" style="text-align:left" | Return
 
! scope="col" style="text-align:left" | Return
 
! scope="col" style="text-align:left" | {{DataType|Float}}
 
! scope="col" style="text-align:left" | {{DataType|Float}}
! scope="col" style="text-align:left" | the result of n^&frac12;
+
! scope="col" style="text-align:left" | the result of x^y;
 
|}
 
|}
  
 
== Detailed Description ==
 
== Detailed Description ==
  
The <code>{{SailFunc|sqrt}}()</code> function returns the square root of a number.
+
The <code>{{SailFunc|pow}}()</code> function returns x to the power of y (x^y).
  
 
== Examples ==
 
== Examples ==
Line 34: Line 36:
 
! scope="col" style="text-align:left" | Notes
 
! scope="col" style="text-align:left" | Notes
 
|-
 
|-
|<code>{{SailFunc|sqrt}}(9);</code> || 3.0... ||
+
|<code>{{SailFunc|pow}}(2, 5);</code> || 32.0... ||
|-
 
|<code>{{SailFunc|sqrt}}(130);</code> || 11.401754... ||
 
 
|-
 
|-
|<code>{{SailFunc|sqrt}}(-49);</code> || nan ||
+
|<code>{{SailFunc|pow}}(3.5f, 5);</code> || 525.21875... ||
 
|}
 
|}

Revision as of 11:11, 14 October 2016

Function Returns Introduced Description
pow Float v5.1.0 Calculates x to the power of y (x^y)

See Also:

Prototype

Float pow(Float/Integer x, Integer y);

Parameters/Return Value

Parameter Data Type Description
x Integer the base number
y Integer the power value
Return Float the result of x^y;

Detailed Description

The pow() function returns x to the power of y (x^y).

Examples

Example Result Notes
pow(2, 5); 32.0...
pow(3.5f, 5); 525.21875...