Difference between revisions of "SHIP:Sail:pow"

From Serious Documentation
Jump to: navigation, search
(Created page with "__NOTOC__ {{SailFuncTableStart|}}<onlyinclude> |{{SailFunc|pow}}||{{DataType|Float}}||style="text-align:center;"|v5.1.0||Return base to the given power{{v5}}</onlyinclude> |}...")
 
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
{{SailFuncTableStart|}}<onlyinclude>
 
{{SailFuncTableStart|}}<onlyinclude>
|{{SailFunc|pow}}||{{DataType|Float}}||style="text-align:center;"|v5.1.0||Return base to the given power{{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|pow}}({{DataType|Float}} b, {{DataType|Float}} p);</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
 
|-
 
|-
|b||{{DataType|Integer}}||the base to be raised to the power of
+
|x||{{DataType|Integer}}||the base number
 
|-
 
|-
|p||{{DataType|Integer}}||the power to raise the base
+
|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 b^p
+
! scope="col" style="text-align:left" | the result of x^y;
 
|}
 
|}
  
 
== Detailed Description ==
 
== Detailed Description ==
  
The <code>{{SailFunc|pow}}()</code> function returns the result of b to the power of p.
+
The <code>{{SailFunc|pow}}()</code> function returns x to the power of y (x^y).
  
 
== Examples ==
 
== Examples ==
Line 38: Line 38:
 
|<code>{{SailFunc|pow}}(2, 5);</code> || 32.0... ||
 
|<code>{{SailFunc|pow}}(2, 5);</code> || 32.0... ||
 
|-
 
|-
|<code>{{SailFunc|pow}}(9, 0.5f);</code> || 3.0... ||
+
|<code>{{SailFunc|pow}}(3.5f, 5);</code> || 525.21875... ||
|-
 
|<code>{{SailFunc|pow}}(125, 0.333333333f);</code> || 5.0... ||
 
|-
 
|<code>{{SailFunc|pow}}(-7, 1/2);</code> || nan ||
 
 
|}
 
|}
 +
 +
[[Category: Numeric Functions]]

Latest revision as of 12:35, 10 November 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...