View source code
Display the source code in std/bigint.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Function std.bigint.powmod
Fast power modulus calculation for BigInt
operands.
Parameters
Name | Description |
---|---|
base | the BigInt is basic operands. |
exponent | the BigInt is power exponent of base. |
modulus | the BigInt is modules to be modular of base ^ exponent. |
Returns
The power modulus value of (base ^ exponent) % modulus.
Example
for powmod
BigInt base = BigInt("123456789012345678901234567890");
BigInt exponent = BigInt("1234567890123456789012345678901234567");
BigInt modulus = BigInt("1234567");
BigInt result = powmod(base, exponent, modulus);
writeln(result); // 359079
Authors
Don Clugston
License
Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.