PreviousPrime (Float function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(30 intermediate revisions by 4 users not shown)
Line 1: Line 1:
This [[Intrinsic classes|intrinsic]] function returns the [http://en.wikipedia.org/wiki/Prime_number prime number] that immediately precedes the method
{{Template:Float:PreviousPrime subtitle}}
object value.


The PreviousPrime function is available as of version 7.3 of the [[Sirius Mods]].
The <var>PreviousPrime</var> [[Intrinsic classes|intrinsic]] function returns the [http://en.wikipedia.org/wiki/Prime_number prime number] that immediately precedes the method object value.
===PreviousPrime syntax===
  %value = number:PreviousPrime
====Syntax terms====
<dl>
<dt>%value
<dd>A numeric variable to receive the method result.
<dt>number
<dd>A Float value.
</dl>
===Usage Notes===
*The method object value is initially rounded to the nearest integer before the preceding prime is determined.
*If ''number'' rounds to 2 or less or is greater than 2<sup>31</sup>-1, the request is cancelled.
*PreviousPrime always returns a value lower than the method object value, even if the method object value is prime.
===Examples===
The following statement returns &ldquo;''2.8:previousPrime = 2''&rdquo;.
    PrintText {~} = {2.8:previousPrime}


===See also===
==Syntax==
[[List of intrinsic Float methods]]
{{Template:Float:PreviousPrime syntax}}
[[Category: Intrinsic Float methods|PreviousPrime function]]
[[Category: Intrinsic methods]]


===Syntax terms===
<table class="syntaxTable">
<tr><th>%number</th>
<td>A numeric variable to receive the method result. </td></tr>


<tr><th>float</th>
<td>A <var>Float</var> value.</td></tr>
</table>


<!--
==Usage notes==
<section begin=dpl_desc />
<ul>
Find previous prime number
<li>The method object value, <var class="term">float</var>, is initially rounded to the nearest integer before the preceding prime is determined.
<section end=dpl_desc />
 
-->
<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 current <var class="term">float</var> value, even if <var class="term">float</var> is currently prime.
 
<li><var>PreviousPrime</var> is available as of <var class="product">Sirius Mods</var> Version 7.3.
</ul>
 
==Examples==
The following statement returns <code>2.8:previousPrime = 2</code>.
<p class="code">[[PrintText statement|printText]] {~} = {2.8:previousPrime}
</p>
 
==See also==
{{Template:Float:PreviousPrime footer}}

Latest revision as of 18:05, 2 November 2012

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, float, 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 current float value, even if float is currently prime.
  • PreviousPrime is available as of Sirius Mods Version 7.3.

Examples

The following statement returns 2.8:previousPrime = 2.

printText {~} = {2.8:previousPrime}

See also