All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
log1m_exp.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_SCAL_FUN_LOG1M_EXP_HPP
#define STAN_MATH_PRIM_SCAL_FUN_LOG1M_EXP_HPP
#include <stan/math/prim/scal/fun/log1m.hpp>
#include <boost/math/tools/promotion.hpp>
#include <boost/throw_exception.hpp>
#include <cmath>
#include <limits>
#include <stdexcept>
namespace stan {
namespace math {
template <typename T>
inline typename boost::math::tools::promote_args<T>::type
log1m_exp(const T a) {
using std::log;
using std::exp;
using ::expm1;
if (a >= 0)
return std::numeric_limits<double>::quiet_NaN();
else if (a > -0.693147)
return log(-expm1(a)); // 0.693147 ~= log(2)
else
return log1m(exp(a));
}
}
}
#endif
stan::math::log
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:15
stan::math::expm1
fvar< T > expm1(const fvar< T > &x)
Definition: expm1.hpp:12
stan::math::exp
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
stan::math::log1m_exp
fvar< T > log1m_exp(const fvar< T > &x)
Definition: log1m_exp.hpp:16
log1m.hpp
stan::math::log1m
fvar< T > log1m(const fvar< T > &x)
Definition: log1m.hpp:16

[ Stan Home Page ] © 2011–2015, Stan Development Team.