use strict; use warnings; use Math::MPFR qw(:mpfr); my $prec_53 = Rmpfr_init2(53); my $prec_4000 = Rmpfr_init2(4000); my $d = 1.3; Rmpfr_set_d($prec_53, $d, MPFR_RNDN); # The 53 bits of $prec_53 are now set to: # 10100110011001100110011001100110011001100110011001101 Rmpfr_set_d($prec_4000, $d, MPFR_RNDN); # The first 53 bits are as for $prec_53 # The remaining 3947 bits are 0. # But we'll run a check: die "Things aint right" if $prec_53 != $prec_4000; print "$prec_53\n"; # prints 1.3 print "$prec_4000\n"; # prints 1.3000000000000000444089209850062616169452667236328125