robert44444uk has asked for the wisdom of the Perl Monks concerning the following question:
Dear Perl Monks, I want to use the exact Chinese Remainder Theorem solution in a program I am constructing but I am not confident which of the two long numbers below will be used by the scalar $crt1 in my program, or even which of the two is correct, although my gut tells me it is the solution shown by "say" is probably the one.
What coding should I use to ensure that $crt1 is always used correctly and printed correctly? Very grateful for your enlightenment.
#!/usr/bin/env perl use warnings; use strict; use Math::BigFloat lib=>"GMP"; use Math::Prime::Util qw/:all/; use feature ':5.10'; my $crt1=chinese([1,2],[1,3],[1,5],[5,7],[4,11],[9,13],[0,17],[14,19], +[22,23],[28,29],[28,31],[27,37],[3,41],[15,43],[9,47],[51,53],[55,59] +,[35,61],[17,67],[35,71],[67,73],[28,79]); say $crt1; printf ("crt solution is= %.0f\n",$crt1);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using big numbers correctly
by thanos1983 (Parson) on Oct 16, 2018 at 10:13 UTC | |
by robert44444uk (Acolyte) on Oct 16, 2018 at 10:41 UTC | |
by robert44444uk (Acolyte) on Oct 16, 2018 at 11:09 UTC | |
by syphilis (Archbishop) on Oct 16, 2018 at 11:48 UTC |