develooper Front page | perl.perl5.porters | Postings from May 2008

Re: [perl #54590] "Can't take log of 0" error in perl 5.8.8. 64 bit

From:
Ben Morrow
Date:
May 22, 2008 07:33
Subject:
Re: [perl #54590] "Can't take log of 0" error in perl 5.8.8. 64 bit
Message ID:
67cgg5-fbs.ln1@osiris.mauzo.dyndns.org

Quoth h.m.brand@xs4all.nl ("H.Merijn Brand"):
> On Thu, 22 May 2008 15:27:38 +0200, Abigail <abigail@abigail.be> wrote:
> 
> > On Wed, May 21, 2008 at 10:14:48AM -0700, Lourdes Pe??a Castillo wrote:
> > > # New Ticket Created by  "Lourdes Pe??a Castillo" 
> > > # Please include the string:  [perl #54590]
> > > # in the subject line of all future correspondence about this issue. 
> > > # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=54590 >
> > > 
> > > 
> > > Hi,
> > > 
> > > If I run the following code in  perl  v5.8.8 built for
> > > x86_64-linux-thread-multi, l get the error "Can't take log of 0 at - line
> > > 1."
> > > 
> > > perl
> > > print log(2.5e-310)/log(10);
> > > ^D
> > > 
> > > But if I run it in perl v5.8.7 built for i486-linux-gnu-thread-multi, I get
> > > the answer -309.602059991328.
> > > 
> > > Is this  a known issue with perl 5.8.8. for 64bits? Thanks!
> > 
> > I see a difference depending on whether Perl was build using 64 bit
> > integers or not, I get the error when running with 32 bit build, and
> > -309.602059991327962 when running with a 64 bit build. The version
> > (5.8.7, 5.8.8, 5.10.0) doesn't matter, nor does it matter whether it
> > was build with threads or not.
> > 
> > It seems that in a 32-bit build, 2.5e-310 gets constant folded to 0.
> 
> weird. both my perls were 64bitint. one of them 64bitall
> that doesn't match your finding

On i386-freebsd, with both 5.8 and 5.10, I seem to consistently get the
error with DEBUGGING perls and the correct answer with non-DEBUGGING
perls, regardless of 64bitint.

Ben

-- 
Musica Dei donum optimi, trahit homines, trahit deos.    |
Musica truces mollit animos, tristesque mentes erigit.   |   ben@morrow.me.uk
Musica vel ipsas arbores et horridas movet feras.        |



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About