PreviousPrime (Float function)

From m204wiki
Revision as of 18:05, 2 November 2012 by JAL (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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