# sub dd_str takes a string as its arg and returns # the 2 doubles that form the doubledouble. # Works correctly if default Math::MPFR precision is # 2098 bits - else might return incorrect values. sub dd_str { # Set $val to the 2098 bit representation of $_[0] my $val = Math::MPFR->new($_[0]); # Most significant double is $val converted to a # double, rounding to nearest with ties to even my $msd = Rmpfr_get_d($val, MPFR_RNDN); $val -= $msd; # Least siginificant double is $val converted # to a double. return ($msd, Rmpfr_get_d($val, MPFR_RNDN)); }