in reply to Re^3: Decimal Floating Point (DFP) and does Perl needs DFP?
in thread Decimal Floating Point (DFP) and does Perl needs DFP?

Right you are about the __float128 case. After rewriting the constant as (__float128)1000001 / 1e6, my result now matches your calculation.

I'm inclined to think the bc-calculated value is accurate. But verifying that is rather laborious, for 1000001**6e7 is a number with ca 360M decimal digits.

Replies are listed 'Best First'.
Re^5: Decimal Floating Point (DFP) and does Perl needs DFP?
by syphilis (Archbishop) on Jan 19, 2015 at 23:34 UTC
    I'm inclined to think the bc-calculated value is accurate

    Yes, and the mpfr library agrees:
    C:\>perl -MMath::MPFR=":mpfr" -le "Rmpfr_set_default_prec(1000000); $x +=Math::MPFR->new('1.000001'); $x **= 60000000; $x *= 10; Rmpfr_out_st +r($x, 10,43,MPFR_RNDN); 1.141973130130727445029596475971653735685612e27
    That's calculated with a million bits of precision - and gives the same result as when calculated with a thousand bits of precision.
    So I think we can rest assured that that is the correct figure for 43 decimal digits.

    Cheers,
    Rob