ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
mfexpcon.cpp
Go to the documentation of this file.
00001 /*
00002 \file Robust exponential functions for constant scalar objects.
00003 
00004 Author: David Fournier
00005 Copyright (c) 2008-2015 Regents of the University of California
00006 */
00007 #include <fvar.hpp>
00008 
00022 double mfexp(double x, double b)
00023 {
00024   if (x > b)
00025   {
00026     return exp(b)*(1.+2.*(x-b))/(1.+x-b);
00027   }
00028   else if (x < -b)
00029   {
00030     return exp(-b)*(1.-x-b)/(1.+2.*(-x-b));
00031   }
00032   return exp(x);
00033 }
00047 double mfexp(double x)
00048 {
00049   double b = 60;
00050   return mfexp(x, b);
00051 }
00052