in reply to Re: Using big numbers correctly
in thread Using big numbers correctly
Hi BR. Thanks for the reply. The used of chinese as an instruction works in my code, the result is a long number, 954846259588805228035541587771, much greater than 2^64. My question is how to ensure that the result is used properly throughout any programming thereafter, and how the result is shown using print or printf.
using the instruction print $crt1 -> bdstr(); produces the same result as the say instruction, which makes me think that probably $crt1 is being used correctly, but how can that instruction be used with a more complex print or printf line, whose output reads "crt solution is (put correct long number here)". Below is proof that the use of bdstr works
#!/usr/bin/env perl use warnings; use strict; use Math::BigFloat lib=>"GMP"; use Math::Prime::Util qw/:all/; use Math::BigInt qw/:constant/; 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; print $crt1 -> bdstr();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Using big numbers correctly
by robert44444uk (Acolyte) on Oct 16, 2018 at 11:09 UTC | |
by syphilis (Archbishop) on Oct 16, 2018 at 11:48 UTC |