Ignore:
Timestamp:
Nov 5, 2010, 3:45:55 PM (14 years ago)
Author:
garnier
Message:

update ti head

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/global/management/src/G4Pow.cc

    r1337 r1340  
    2424// ********************************************************************
    2525//
    26 // $Id: G4Pow.cc,v 1.2 2009/07/03 11:35:06 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     26// $Id: G4Pow.cc,v 1.4 2010/08/24 08:12:08 gcosmo Exp $
     27// GEANT4 tag $Name: global-V09-03-22 $
    2828//
    2929// -------------------------------------------------------------------
     
    6565  lz.resize(maxZ,0.0);
    6666  fact.resize(maxZ,0.0);
     67  logfact.resize(maxZ,0.0);
    6768
    6869  onethird = 1.0/3.0;
    6970  G4double f = 1.0;
    7071
    71   for(G4int i=1; i<maxZ; i++)
     72  for(G4int i=1; i<maxZ; ++i)
    7273  {
    7374    G4double x  = G4double(i);
     
    7677    f      *= x;
    7778    fact[i] = f;
     79    logfact[i] = std::log(f);
    7880  }
    7981  fact[0] = 1.0;
     82  logfact[0] = 0.0;
    8083}
    8184
     
    8689
    8790// -------------------------------------------------------------------
     91
     92G4double G4Pow::powN(G4double x, G4int n)
     93{
     94  G4double res = 1.0;
     95  if(n >= 0) { for(G4int i=0; i<n; ++i) { res *= x; } }
     96  else if((n < 0) && (x != 0.0))
     97  {
     98    G4double y = 1.0/x;
     99    G4int nn = -n;
     100    for(G4int i=0; i<nn; ++i) { res *= y; }
     101  }
     102  return res;
     103}
Note: See TracChangeset for help on using the changeset viewer.