NextPrime (Float function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (it's not number it's float)
m (it's not number it's float)
Line 17: Line 17:
<li><var>NextPrime</var> always returns a value higher than the current <var class="term">float</var> value, even if <var class="term">float</var> is currently prime.
<li><var>NextPrime</var> always returns a value higher than the current <var class="term">float</var> value, even if <var class="term">float</var> is currently prime.
<li>If <var class="term">float</var> is a negative value or is greater than 2<sup>31</sup>-1, the request is cancelled.
<li>If <var class="term">float</var> is a negative value or is greater than 2<sup>31</sup>-1, the request is cancelled.
<li><var>NextPrime</var> is available as of <var class="product">[[Sirius Mods|"Sirius Mods"]]</var> Version 7.3.</ul>
<li><var>NextPrime</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 smallest prime greater than this number (Float class)


The NextPrime intrinsic function returns the next prime number after the method object value.

Syntax

%number = float:NextPrime

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 next prime is determined.
  • NextPrime always returns a value higher than the current float value, even if float is currently prime.
  • If float is a negative value or is greater than 231-1, the request is cancelled.
  • NextPrime is available as of Sirius Mods Version 7.3.

Examples

  1. The following request displays the first one hundred prime numbers after 1000:

    begin %i is float %n is float %n = 1000 for %i from 1 to 100 %n = %n:nextPrime printText {%n} end for end

See also