Skip to content
This repository
Browse code

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

  • Loading branch information...
commit 5277fefed694bbdfc3e5da1022ceaf5aacb6d344 1 parent b3233b4
Larry Wall TimToady authored

Showing 1 changed file with 24 additions and 2 deletions. Show diff stats Hide diff stats

  1. +24 2 S32-setting-library/Numeric.pod
26 S32-setting-library/Numeric.pod
Source Rendered
@@ -20,8 +20,8 @@ DRAFT: Synopsis 32: Setting Library - Numeric
20 20
21 21 Created: 19 Mar 2009 extracted from S29-functions.pod
22 22
23   - Last Modified: 9 May 2012
24   - Version: 14
  23 + Last Modified: 19 Sept 2012
  24 + Version: 15
25 25
26 26 The document is a draft.
27 27
@@ -479,6 +479,28 @@ the quadrant into account. Otherwise behaves as other trigonometric functions.
479 479
480 480 An C<Int> is an immutable, integral number of arbitrary size.
481 481
  482 +=over
  483 +
  484 +=item expmod
  485 +
  486 + multi method expmod ( Int $x: Int $y, Int $mod --> Int ) is export
  487 +
  488 +Returns C<$x> raised to the C<$y> power within modulus C<$mod>.
  489 +
  490 +=item is-prime
  491 +
  492 + multi method is-prime ( Int $x: Int $tries = 100) is export
  493 +
  494 +Returns True if C<$x> is known to be a prime, or is likely to be a
  495 +prime based on a probabalistic Miller-Rabin test. (The optional
  496 +argument tells how many times to iterate the probabalistic test,
  497 +if such is necessary.)
  498 +
  499 +Returns False if C<$x> is known not to be a prime, or is unlikely to
  500 +be a prime after probabalistic testing.
  501 +
  502 +=back
  503 +
482 504 =head2 Rat
483 505
484 506 class Rat does Real;

0 comments on commit 5277fef

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