Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: "Jeffrey J. Potoff" <jpotoff@rhea.umd.edu>
Subject: Large numbers in F90
Date: 1998/02/11	[thread overview]
Message-ID: <34E22A42.41C6@rhea.umd.edu> (raw)


I have a Fortran 90 code where on occasion I need to take the
exponential of some large numbers (500+).  As you can imagine,
the result is a floating point overflow with real*8.  I was able
to avoid the floating overflow by going real*16, but now the 
code is incredibly slow.  Why is this ?  Is there anyway to gain
some speed or am I doomed ?  Here is the section of code if anyone 
has any ideas for restructuring it.  'prob' can be around 700 
at times, which is causing the problems.  I have a hack that 
may work, but I'd like to avoid it.

Thanks,
	Jeff


  do kfile = 1,nfiles
    weight(kfile) = 0.0
    do ifile = 1,nfiles      
      do i=1,nentry(ifile)
        y = 0.0
        do jfile = 1,nfiles      
          prob = -(beta(jfile)-beta(kfile))*e(i,ifile) +&
          (beta(jfile)*mu1(jfile)-beta(kfile)*mu1(kfile))*n1(i,ifile) +&
          (beta(jfile)*mu2(jfile)-beta(kfile)*mu2(kfile))*n2(i,ifile)
                
          y = y+nentry(jfile)*exp(prob-log(oldweight(jfile))) 
        enddo
        weight(kfile) = weight(kfile)+1./y      
      enddo
    enddo
    val = abs(weight(kfile)/oldweight(kfile)-1.)
    if (val.gt.maxd) maxd=val
  enddo



             reply	other threads:[~1998-02-11  5:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-11  5:00 Jeffrey J. Potoff [this message]
1998-02-12  5:00 ` Large numbers in F90 Pierre Asselin
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox