-----Original Message----- From: Zefram via RT Sent: Monday, October 28, 2013 2:32 AM To: sisyphus1@optusnet.com.au Subject: Re: [perl #120363] perl-5.18.0 apparently miscalculates the NV 1e-298 > I wrote: >> I'm mystified as to how Perl 10**-298 gets a different result from C >> powl(), because pp_pow() clearly uses powl() underneath. > > I've narrowed this difference down to C constant folding. powl() on > literal arguments gets folded at C compile time, and produces a different > result from powl() that actually runs at runtime. Not a Perl bug. > (Still a separate bug from the text->float conversion errors that this > ticket is really concerned with.) Oh, yes - I can see this. It's the difference between doing: long double ld; ld = powl(10.0L, -298.0L); and: long double ld, val, pow; val= 10.0L; pow = -298.0L; ld = powl(val, pow); And this would be a bug in the constant folding, I presume. On Windows, I see the same bug in (mingw64 ports of) both gcc-4.6.3 and gcc-4.8.1. Cheers, RobThread Previous | Thread Next