From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,bf8942033e6cc895,start X-Google-Attributes: gid1164f8,public From: "Jeffrey J. Potoff" Subject: Large numbers in F90 Date: 1998/02/11 Message-ID: <34E22A42.41C6@rhea.umd.edu>#1/1 X-Deja-AN: 324258098 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: University of Maryland, College Park Newsgroups: comp.sys.dec 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