Raku Books / Using Raku / Numbers / Using numbers
26. Multiplying big numbers
Create a program to multiply very big integer numbers.
The support for big numbers is built-in: the Int class
allows arbitrary precision. You do not have to do any extra work. You
just take the numbers and multiply them, as shown in the example
(numbers should be written on one line, and without spaces, of
course):
my $a =
83274938493874832658327320948349783624839479683297463483
72463286948532460989746932849382643928497328656329878246
39847823659328476832647392847836539843928645384329463287
53924837825643824302487637563724384782374803284710339876;
my $b =
23849389520394874100302935470340851094327485279287346539
23423599234023403275324932549011093234845878830238479823
38497357295682768498203985784582309487857450938547650202
34958452087248754293875293059257429584375683984543867549;
say $a * $b;Run the program and check the result :-)
$ raku multiply.rk
1986056445427346134608816461674104817709618067621430859563207
9414372265722581757276335355613160103733076798778347026808946
4764504400339607310787754299375646554963128327698080593673173
1567112322543695408638461054692799962710717063045632562953661
6550281290208170934822137465164296276863255896755078697996012
2029114902545655702554835467523365237055296210216509834632137
6325794905191426940032936330373925095492741926233188581116641
016422307707317083924