Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

cdf_45.c

Go to the documentation of this file.
00001 #include "cdflib.h"
00002 double dln1px(double *a)
00003 /*
00004 **********************************************************************
00005  
00006      double dln1px(double *a)
00007                Double precision LN(1+X)
00008  
00009  
00010                               Function
00011  
00012  
00013      Returns ln(1+x)
00014      Note that the obvious code of
00015                LOG(1.0+X)
00016      won't work for small X because 1.0+X loses accuracy
00017  
00018  
00019                               Arguments
00020  
00021  
00022      X --> Value for which ln(1-x) is desired.
00023                                         X is DOUBLE PRECISION
00024  
00025  
00026                               Method
00027  
00028  
00029      Renames ALNREL from:
00030      DiDinato, A. R. and Morris,  A.   H.  Algorithm 708: Significant
00031      Digit Computation of the Incomplete  Beta  Function Ratios.  ACM
00032      Trans. Math.  Softw. 18 (1993), 360-373.
00033  
00034 **********************************************************************
00035 -----------------------------------------------------------------------
00036             EVALUATION OF THE FUNCTION LN(1 + A)
00037 -----------------------------------------------------------------------
00038 */
00039 {
00040 static double p1 = -.129418923021993e+01;
00041 static double p2 = .405303492862024e+00;
00042 static double p3 = -.178874546012214e-01;
00043 static double q1 = -.162752256355323e+01;
00044 static double q2 = .747811014037616e+00;
00045 static double q3 = -.845104217945565e-01;
00046 static double dln1px,t,t2,w,x;
00047 /*
00048      ..
00049      .. Executable Statements ..
00050 */
00051     if(fabs(*a) > 0.375e0) goto S10;
00052     t = *a/(*a+2.0e0);
00053     t2 = t*t;
00054     w = (((p3*t2+p2)*t2+p1)*t2+1.0e0)/(((q3*t2+q2)*t2+q1)*t2+1.0e0);
00055     dln1px = 2.0e0*t*w;
00056     return dln1px;
00057 S10:
00058     x = 1.e0+*a;
00059     dln1px = log(x);
00060     return dln1px;
00061 } /* END */
 

Powered by Plone

This site conforms to the following standards: