Changes in / [c31dcdb1:8e7044c] in sasview


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/calculator/c_extensions/libfunc.c

    r197260f r9e531f2  
    8787} 
    8888 
    89 /* 
     89 
    9090double gamln(double xx) { 
    9191 
     
    103103    return -tmp+log(2.5066282746310005*ser/x); 
    104104} 
    105 */ 
     105 
    106106// calculate magnetic sld and return total sld 
    107107// bn : contrast (not just sld of the layer) 
     
    236236 
    237237/** 
    238 Wojtek's comment Mar 22 2016: The remaing code can mostly likely be deleated 
    239 Keeping it in order to check if it is not breaking anything 
     238   Implements eq 6.2.5 (small gamma) of Numerical Recipes in C, essentially 
     239   the incomplete gamma function multiplied by the gamma function. 
     240   Required for implementation of fast error function (erf) 
    240241**/ 
    241242 
     
    249250  float sum,del,ap; 
    250251 
    251   *gln = lgamma(a); 
     252  *gln = gamln(a); 
    252253  if(x <= 0.0) { 
    253254    if (x < 0.0) printf("Error: x less than 0 in routine gser"); 
     
    279280   representation 
    280281**/ 
     282 
    281283void gcf(float *gammcf, float a, float x, float *gln) { 
    282284  int i; 
    283285  float an,b,c,d,del,h; 
    284286 
    285   *gln = lgamma(a); 
     287  *gln = gamln(a); 
    286288  b = x+1.0-a; 
    287289  c = 1.0/FPMIN; 
     
    305307} 
    306308 
     309 
    307310/** 
    308311   Represents incomplete error function, P(a,x) 
     
    319322  } 
    320323} 
     324 
    321325/** 
    322326    Implementation of the error function, erf(x) 
    323327**/ 
     328 
    324329float erff(float x) { 
    325330  return x < 0.0 ? -gammp(0.5,x*x) : gammp(0.5,x*x); 
    326331} 
     332 
Note: See TracChangeset for help on using the changeset viewer.