PreviousPrime (Float function): Difference between revisions

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


The PreviousPrime function is available as of version 7.3 of the [[Sirius Mods]].
The PreviousPrime function is available as of version 7.3 of the [[Sirius Mods]].
===PreviousPrime syntax===
==Syntax==
  %value = number:PreviousPrime
{{Template:Float:PreviousPrime syntax}}
====Syntax terms====
===Syntax terms===
<dl>
<dl>
<dt>%value
<dt>%value
Line 12: Line 14:
<dd>A Float value.
<dd>A Float value.
</dl>
</dl>
===Usage Notes===
==Usage notes==
*The method object value is initially rounded to the nearest integer before the preceding prime is determined.
*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.
*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.
*PreviousPrime always returns a value lower than the method object value, even if the method object value is prime.
===Examples===
==Examples==
The following statement returns &ldquo;''2.8:previousPrime = 2''&rdquo;.
The following statement returns "''2.8:previousPrime = 2''".
     PrintText {~} = {2.8:previousPrime}
     PrintText {~} = {2.8:previousPrime}



Revision as of 13:42, 19 January 2011

Find greatest prime smaller than this number (Float class)


This intrinsic function returns the prime number that immediately precedes the method object value.

The PreviousPrime function is available as of version 7.3 of the Sirius Mods.

Syntax

%number = float:PreviousPrime

Syntax terms

%value
A numeric variable to receive the method result.
number
A Float value.

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 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.

Examples

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

   PrintText {~} = {2.8:previousPrime}

See also

List of intrinsic Float methods