Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 23 lines (17 sloc) 0.743 kB
6aff7bd @colomon Add some basic tests for expmod.
colomon authored
1 use v6;
2 use Test;
f29377c @colomon Add tests for sub form of expmod.
colomon authored
3 plan 117;
6aff7bd @colomon Add some basic tests for expmod.
colomon authored
4
5 # L<S32::Numeric/Numeric/"=item expmod">
6
7 =begin pod
8
9 Basic tests for the expmod() builtin
10
11 =end pod
12
13 for 2..30 -> $i {
f29377c @colomon Add tests for sub form of expmod.
colomon authored
14 is 7.expmod($i, 10), 7 ** $i % 10, "7.expmod($i, 10) == { 7 ** $i % 10 }";
15 is 9.expmod($i, 10), 9 ** $i % 10, "9.expmod($i, 10) == { 9 ** $i % 10 }";
16 is expmod(11, $i, 8), 11 ** $i % 8, "expmod(11, $i, 8) == { 11 ** $i % 8 }";
17 is expmod(13, $i, 12), 13 ** $i % 12, "expmod(13, $i, 12) == { 13 ** $i % 12 }";
6aff7bd @colomon Add some basic tests for expmod.
colomon authored
18 }
19
20 is 2988348162058574136915891421498819466320163312926952423791023078876139.expmod(
21 2351399303373464486466122544523690094744975233415544072992656881240319,
22 10 ** 40),
23 1527229998585248450016808958343740453059, "Rosettacode example is correct";
Something went wrong with that request. Please try again.