develooper Front page | perl.perl5.porters | Postings from October 2013

Re: [perl #120363] perl-5.18.0 apparently miscalculates the NV 1e-298

Thread Previous | Thread Next
October 25, 2013 13:12
Re: [perl #120363] perl-5.18.0 apparently miscalculates the NV 1e-298
Message ID: wrote:
>But on the perl built with nvtype eq 'long double', things are worse
>with 10 ** -298:

Ooh, interesting.  OK, I get the same values as you.  In summary (via

+0x1.0be08d0527e1d69cp-990    C source (gcc) 1e-298L, C strtold "1e-298",
                              C powl(10.0L, -298.0L),
			      actual closest representable to 10**-298
+0x1.0be08d0527e1d6a0p-990    Perl (source or runtime string coercion) 1e-298
+0x1.0be08d0527e1d786p-990    Perl 10**-298

I'm mystified as to how Perl 10**-298 gets a different result from C
powl(), because pp_pow() clearly uses powl() underneath.  Even if it
were using the lower precision pow(), that would lead to the low-order
bits being zero, not the inaccurate bits that we see.  Anyway, I reckon
pp_pow giving the wrong answer is a separate bug from the text->float
conversion errors that this ticket started with.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About