PreviousPrime (Float function): Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
m (match syntax diagram to template; fix tags and links) |
||
Line 1: | Line 1: | ||
{{Template:Float:PreviousPrime subtitle}} | {{Template:Float:PreviousPrime subtitle}} | ||
The <var>PreviousPrime</var> <var>[[Intrinsic classes|intrinsic]]</var> function returns the [http://en.wikipedia.org/wiki/Prime_number prime number] that immediately precedes the method object value. | |||
object value. | |||
==Syntax== | ==Syntax== | ||
{{Template:Float:PreviousPrime syntax}} | {{Template:Float:PreviousPrime syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>% | <tr><th>%number</th> | ||
<td>A numeric variable to receive the method result. </td></tr> | <td>A numeric variable to receive the method result. </td></tr> | ||
<tr><th> | <tr><th>float</th> | ||
<td>A <var>Float</var> value.</td></tr> | <td>A <var>Float</var> value.</td></tr> | ||
</table> | </table> | ||
==Usage notes== | ==Usage notes== | ||
<ul><li>The method object value is initially rounded to the nearest integer before the preceding prime is determined. | |||
<li>If <var class="term">float</var> rounds to 2 or less or is greater than 2<sup>31</sup>-1, the request is cancelled. | |||
<li><var>PreviousPrime</var> always returns a value lower than the method object value, even if the method object value is prime. | |||
<li><var>PreviousPrime</var> is available as of <var class="product">[[Sirius Mods|"Sirius Mods"]]</var> Version 7.3.</ul> | |||
==Examples== | ==Examples== | ||
The following statement returns | <ol><li>The following statement returns <code>2.8:previousPrime = 2</code>. | ||
<p class="code">PrintText {~} = {2.8:previousPrime} | <p class="code">[[PrintText statement|printText]] {~} = {2.8:previousPrime} | ||
</p></ol> | |||
==See also== | ==See also== | ||
{{Template:Float:PreviousPrime footer}} | {{Template:Float:PreviousPrime footer}} |
Revision as of 05:41, 4 February 2011
Find greatest prime smaller than this number (Float class)
The PreviousPrime intrinsic function returns the prime number that immediately precedes the method object value.
Syntax
%number = float:PreviousPrime
Syntax terms
%number | A numeric variable to receive the method result. |
---|---|
float | A Float value. |
Usage notes
- The method object value is initially rounded to the nearest integer before the preceding prime is determined.
- If float rounds to 2 or less or is greater than 231-1, the request is cancelled.
- PreviousPrime always returns a value lower than the method object value, even if the method object value is prime.
- PreviousPrime is available as of "Sirius Mods" Version 7.3.
Examples
- The following statement returns
2.8:previousPrime = 2
.printText {~} = {2.8:previousPrime}