Skip to content
Browse files

Add expmod and is-prime as built-ins in Int

  • Loading branch information...
1 parent b3233b4 commit 5277fefed694bbdfc3e5da1022ceaf5aacb6d344 @TimToady TimToady committed Sep 19, 2012
Showing with 24 additions and 2 deletions.
  1. +24 −2 S32-setting-library/Numeric.pod
View
26 S32-setting-library/Numeric.pod
@@ -20,8 +20,8 @@ DRAFT: Synopsis 32: Setting Library - Numeric
Created: 19 Mar 2009 extracted from S29-functions.pod
- Last Modified: 9 May 2012
- Version: 14
+ Last Modified: 19 Sept 2012
+ Version: 15
The document is a draft.
@@ -479,6 +479,28 @@ the quadrant into account. Otherwise behaves as other trigonometric functions.
An C<Int> is an immutable, integral number of arbitrary size.
+=over
+
+=item expmod
+
+ multi method expmod ( Int $x: Int $y, Int $mod --> Int ) is export
+
+Returns C<$x> raised to the C<$y> power within modulus C<$mod>.
+
+=item is-prime
+
+ multi method is-prime ( Int $x: Int $tries = 100) is export
+
+Returns True if C<$x> is known to be a prime, or is likely to be a
+prime based on a probabalistic Miller-Rabin test. (The optional
+argument tells how many times to iterate the probabalistic test,
+if such is necessary.)
+
+Returns False if C<$x> is known not to be a prime, or is unlikely to
+be a prime after probabalistic testing.
+
+=back
+
=head2 Rat
class Rat does Real;

0 comments on commit 5277fef

Please sign in to comment.
Something went wrong with that request. Please try again.