ADMB Documentation  11.1x.2732
 All Classes Files Functions Variables Typedefs Friends Defines
mfexpcon.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: mfexpcon.cpp 2076 2014-06-09 18:35:10Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include <fvar.hpp>
00012 
00026   double mfexp(double x)
00027   {
00028     double b = 60;
00029     if (x<=b && x>=-b)
00030     {
00031       return exp(x);
00032     }
00033     else if (x>b)
00034     {
00035       return exp(b)*(1.+2.*(x-b))/(1.+x-b);
00036     }
00037     else
00038     {
00039       return exp(-b)*(1.-x-b)/(1.+2.*(-x-b));
00040     }
00041   }
00042 
00056   double mfexp(double x,double b)
00057   {
00058     if (x<=b && x>=-b)
00059     {
00060       return exp(x);
00061     }
00062     else if (x>b)
00063     {
00064       return exp(b)*(1.+2.*(x-b))/(1.+x-b);
00065     }
00066     else
00067     {
00068       return exp(-b)*(1.-x-b)/(1.+2.*(-x-b));
00069     }
00070   }