ToFloatPower (Float function): Difference between revisions
Jump to navigation
Jump to search
m (updates to reflect changes in syntax template, correct some busted tags) |
m ($RXPR is not a link) |
||
Line 20: | Line 20: | ||
<li>If <var class="term">float</var> is less than 0, and <var class="term">exponent</var> is not 0, the request is cancelled. This is so because, unlike <var>[[ToIntegerPower_(Float_function)|ToIntegerPower]]</var>, the computation algorithm involves the log of <var class="term">float</var>. | <li>If <var class="term">float</var> is less than 0, and <var class="term">exponent</var> is not 0, the request is cancelled. This is so because, unlike <var>[[ToIntegerPower_(Float_function)|ToIntegerPower]]</var>, the computation algorithm involves the log of <var class="term">float</var>. | ||
<li><var>ToFloatPower</var> uses good-fit techniques that sometimes produce slightly different results from ToIntegerPower with the same inputs. | <li><var>ToFloatPower</var> uses good-fit techniques that sometimes produce slightly different results from ToIntegerPower with the same inputs. | ||
<li><var>ToFloatPower</var> is an object-oriented version of the Rocket function: <var>$RXPR</var>. | |||
<li><var>ToFloatPower</var> is available as of <var class="product">[[Sirius Mods|"Sirius Mods"]]</var> Version 7.3.</ul> | <li><var>ToFloatPower</var> is available as of <var class="product">[[Sirius Mods|"Sirius Mods"]]</var> Version 7.3.</ul> | ||
Line 25: | Line 26: | ||
<ol><li>For example: | <ol><li>For example: | ||
<p class="code">begin | <p class="code">begin | ||
printText {~} = {3:toFloatPower(6)} | |||
printText {~} = {3:toIntegerPower(6)} | printText {~} = {3:toIntegerPower(6)} | ||
printText {~} = {10:toFloatPower(7)} | printText {~} = {10:toFloatPower(7)} | ||
Line 37: | Line 38: | ||
10:toIntegerPower(7) = 10000000 | 10:toIntegerPower(7) = 10000000 | ||
</p> | </p> | ||
Consequently, you should generally use <var>[[ToIntegerPower_(Float_function)|ToIntegerPower]]</var>unless you really are working with non-integer powers.</ol> | Consequently, you should generally use <var>[[ToIntegerPower_(Float_function)|ToIntegerPower]]</var> unless you really are working with non-integer powers.</ol> | ||
==See also== | ==See also== | ||
<ul><li><var> | <ul><li><var>printText</var> is described in the <var>[[Intrinsic classes#printtext|"System Intrinsic Class"]]</var>. | ||
{{Template:Float:ToFloatPower footer}} | {{Template:Float:ToFloatPower footer}} |
Revision as of 10:25, 22 February 2011
Raise number to a floating point power (Float class)
The ToFloatPower intrinsic function returns a number that is the method object value "raised to the float power" specified by the method argument.
Syntax
%number = float:ToFloatPower( exponent)
Syntax terms
%number | A numeric variable to contain the method result. |
---|---|
float | A Float value. |
exponent | A Float value. |
Usage notes
- If float is equal to 0, and exponent is less than or equal to 0, the request is cancelled.
- If float is less than 0, and exponent is not 0, the request is cancelled. This is so because, unlike ToIntegerPower, the computation algorithm involves the log of float.
- ToFloatPower uses good-fit techniques that sometimes produce slightly different results from ToIntegerPower with the same inputs.
- ToFloatPower is an object-oriented version of the Rocket function: $RXPR.
- ToFloatPower is available as of "Sirius Mods" Version 7.3.
Examples
- For example:
begin printText {~} = {3:toFloatPower(6)} printText {~} = {3:toIntegerPower(6)} printText {~} = {10:toFloatPower(7)} printText {~} = {10:toIntegerPower(7)} end
displays
3:toFloatPower(6) = 728.999999999999 3:toIntegerPower(6) = 729 10:toFloatPower(7) = 9999999.99999997 10:toIntegerPower(7) = 10000000
Consequently, you should generally use ToIntegerPower unless you really are working with non-integer powers.