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> |}...")
 
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|sqrt}}||{{DataType|Float}}||style="text-align:center;"|v5.1.0||Return the square root of the given number{{v5}}</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|sqrt}}({{DataType|Integer}} n);</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
+
|n||{{DataType|Integer}}||the number to take the suqare root of
|-
 
|p||{{DataType|Integer}}||the power to raise the base
 
 
|-
 
|-
 
! 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 n^&frac12;
 
|}
 
|}
  
 
== Detailed Description ==
 
== Detailed Description ==
  
The <code>{{SailFunc|pow}}()</code> function returns the result of b to the power of p.
+
The <code>{{SailFunc|sqrt}}()</code> function returns the square root of a number.
  
 
== Examples ==
 
== Examples ==
Line 36: Line 34:
 
! scope="col" style="text-align:left" | Notes
 
! scope="col" style="text-align:left" | Notes
 
|-
 
|-
|<code>{{SailFunc|pow}}(2, 5);</code> || 32.0... ||
+
|<code>{{SailFunc|sqrt}}(9);</code> || 3.0... ||
|-
 
|<code>{{SailFunc|pow}}(9, 0.5f);</code> || 3.0... ||
 
 
|-
 
|-
|<code>{{SailFunc|pow}}(125, 0.333333333f);</code> || 5.0... ||
+
|<code>{{SailFunc|sqrt}}(130);</code> || 11.401754... ||
 
|-
 
|-
|<code>{{SailFunc|pow}}(-7, 1/2);</code> || nan ||
+
|<code>{{SailFunc|sqrt}}(-49);</code> || nan ||
 
|}
 
|}

Revision as of 15:45, 29 September 2016

Function Returns Introduced Description
sqrt Float v5.1.0 Return the square root of the given numberBadge SHIPv5.gif

See Also:

Prototype

Float sqrt(Integer n);

Parameters/Return Value

Parameter Data Type Description
n Integer the number to take the suqare root of
Return Float the result of n^½

Detailed Description

The sqrt() function returns the square root of a number.

Examples

Example Result Notes
sqrt(9); 3.0...
sqrt(130); 11.401754...
sqrt(-49); nan