bcpowmod

(PHP 5)

bcpowmod --  Raise an arbitrary precision number to another, reduced by a specified modulus

Description

string bcpowmod ( string x, string y, string modulus [, int scale] )

Use the fast-exponentiation method to raise x to the power y with respect to the modulus modulus. The optional scale can be used to set the number of digits after the decimal place in the result.

Note: Because this method uses the modulus operation, non-natural numbers may give unexpected results. A natural number is any positive non-zero integer.

Examples

The following two statements are functionally identical. The bcpowmod() version however, executes in less time and can accept larger parameters.

<?php
$a
= bcpowmod($x, $y, $mod);

$b = bcmod(bcpow($x, $y), $mod);

// $a and $b are equal to each other.

?>

See Also

bcpow() and bcmod().

The Broward PHP Usergroup would like to thank the following sponsors.
  • South Florida Web Design

  • South Florida Maids

  • Miami Cleaning Service

  • Broward PHP Usergroup

  • Nationwide Real Estate Agent Directory

  • Fort Lauderdale Web Design

  • Real Estate Agent

  • Gourmet Flavored Coffee

  • convex optimization

  • convex optimization

  • Nationwide Bail Bonds Agent Directory

  • Fort Lauderdale Computer Repair

  • Broward County Computer Repair

  • dance music video

  • Miami Computer Repair