IsPrime (Float function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
 
(26 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Template:Float:IsPrime subtitle}}
{{Template:Float:IsPrime subtitle}}


This [[Intrinsic classes|intrinsic]] function returns a boolean value that indicates whether the method object value, rounded to an integer, is [http://en.wikipedia.org/wiki/Prime_number prime].
The <var>IsPrime</var> [[Intrinsic classes|intrinsic]] function returns a boolean value that indicates whether the method object value, rounded to an integer, is [http://en.wikipedia.org/wiki/Prime_number prime]. The method returns <code>True</code> if <var class="term">float</var> is prime, and it returns <code>False</code> if it is not prime.
The method returns ''''True'''' if ''number'' is prime, and it returns ''''False'''' if it is not prime.


The IsPrime function is available as of version 7.3 of the [[Sirius Mods]].
==Syntax==
==Syntax==
{{Template:Float:IsPrime syntax}}
{{Template:Float:IsPrime syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%bool </th>
<tr><th>%boolean</th>
<td>An enumeration object of type Boolean to contain the returned value of IsPrime. </td></tr>
<td>An enumeration object of type Boolean to contain the returned value of <var>IsPrime</var>. </td></tr>
<tr><th>number </th>
 
<td>A Float value.</td></tr>
<tr><th>float</th>
<td>A <var>Float</var> value.</td></tr>
</table>
</table>
==Usage notes==
==Usage notes==
*If ''number'' is a negative value or is greater than 2<sup>31</sup>-1, the request is canceled.
<ul>
<li>If <var class="term">float</var> is a negative value or is greater than 2<sup>31</sup>-1, the request is canceled.
<li><var>IsPrime</var> is available as of <var class="product">Sirius Mods</var> Version 7.3.</ul>
 
==Examples==
==Examples==
The following statement returns ''''113:isprime = True''''.
The following statement returns <code>113:isprime = True</code>.
    [[Intrinsic classes#printtext|printText]] {~} = {113:isprime}
<p class="code">[[PrintText statement|printText]] {~} = {113:isprime}
The enumeration value is printed, above, as the result of an implicit ToString method call.
</p>
 
The enumeration value is printed, above, as the result of an implicit <var>[[Enumerations#ToString property|ToString]]</var> property call.
===See also===
[[List of intrinsic Float methods]]
 
[[Category: Intrinsic Float methods|IsPrime function]]
[[Category: Intrinsic methods]]
 
 


<!--
==See also==
<section begin=dpl_desc />
{{Template:Float:IsPrime footer}}
Determine if number is prime
<section end=dpl_desc />
-->

Latest revision as of 23:12, 10 October 2014

Is this number prime? (Float class)


The IsPrime intrinsic function returns a boolean value that indicates whether the method object value, rounded to an integer, is prime. The method returns True if float is prime, and it returns False if it is not prime.

Syntax

%boolean = float:IsPrime

Syntax terms

%boolean An enumeration object of type Boolean to contain the returned value of IsPrime.
float A Float value.

Usage notes

  • If float is a negative value or is greater than 231-1, the request is canceled.
  • IsPrime is available as of Sirius Mods Version 7.3.

Examples

The following statement returns 113:isprime = True.

printText {~} = {113:isprime}

The enumeration value is printed, above, as the result of an implicit ToString property call.

See also