PreviousPrime (Float function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (just floating about)
m (just floating about)
Line 17: Line 17:
<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>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> 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|"Sirius Mods"]]</var> Version 7.3.</ul>
<li><var>PreviousPrime</var> is available as of <var class="product">[[Sirius Mods|Sirius Mods]]</var> Version 7.3.</ul>


==Examples==
==Examples==

Revision as of 17:46, 4 May 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, 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

  1. The following statement returns 2.8:previousPrime = 2.

    printText {~} = {2.8:previousPrime}

See also