max@0: // Copyright (C) 2008-2010 NICTA (www.nicta.com.au) max@0: // Copyright (C) 2008-2010 Conrad Sanderson max@0: // max@0: // This file is part of the Armadillo C++ library. max@0: // It is provided without any warranty of fitness max@0: // for any purpose. You can redistribute this file max@0: // and/or modify it under the terms of the GNU max@0: // Lesser General Public License (LGPL) as published max@0: // by the Free Software Foundation, either version 3 max@0: // of the License or (at your option) any later version. max@0: // (see http://www.opensource.org/licenses for more info) max@0: max@0: max@0: max@0: //! \addtogroup fn_trunc_exp max@0: //! @{ max@0: max@0: max@0: max@0: template max@0: inline max@0: static max@0: typename arma_float_only::result max@0: trunc_exp(const eT x) max@0: { max@0: if(std::numeric_limits::is_iec559 && (x >= Math::log_max() )) max@0: { max@0: return std::numeric_limits::max(); max@0: } max@0: else max@0: { max@0: return std::exp(x); max@0: } max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: static max@0: typename arma_integral_only::result max@0: trunc_exp(const eT x) max@0: { max@0: return eT( trunc_exp( double(x) ) ); max@0: } max@0: max@0: max@0: max@0: template max@0: arma_inline max@0: static max@0: std::complex max@0: trunc_exp(const std::complex& x) max@0: { max@0: return std::exp(x); max@0: } max@0: max@0: max@0: max@0: template max@0: arma_inline max@0: const eOp max@0: trunc_exp(const Base& A) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: return eOp(A.get_ref()); max@0: } max@0: max@0: max@0: max@0: template max@0: arma_inline max@0: const eOpCube max@0: trunc_exp(const BaseCube& A) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: return eOpCube(A.get_ref()); max@0: } max@0: max@0: max@0: max@0: //! @}