CppAD: A C++ Algorithmic Differentiation Package
20130918
|
00001 /* $Id$ */ 00002 # ifndef CPPAD_EPSILON_INCLUDED 00003 # define CPPAD_EPSILON_INCLUDED 00004 /* -------------------------------------------------------------------------- 00005 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell 00006 00007 CppAD is distributed under multiple licenses. This distribution is under 00008 the terms of the 00009 Eclipse Public License Version 1.0. 00010 00011 A copy of this license is included in the COPYING file of this distribution. 00012 Please visit http://www.coin-or.org/CppAD/ for information on other licenses. 00013 -------------------------------------------------------------------------- */ 00014 00015 /* 00016 ------------------------------------------------------------------------------ 00017 $begin epsilon$$ 00018 $spell 00019 std 00020 eps 00021 CppAD 00022 namespace 00023 const 00024 $$ 00025 $index AD, epsilon$$ 00026 $index epsilon, AD$$ 00027 00028 $section Machine Epsilon For AD Types$$ 00029 00030 $head Deprecated$$ 00031 $index deprecated, epsilon$$ 00032 This routine has bee deprecated. 00033 You should use the $cref/numeric_limits/limits/$$ $code epsilon$$ instead. 00034 00035 $head Syntax$$ 00036 $icode%eps% = epsilon<%Float%>()%$$ 00037 00038 $head Purpose$$ 00039 Obtain the value of machine epsilon corresponding 00040 to the type $icode%Float%$$. 00041 00042 $head Float$$ 00043 this type can either be $codei%AD<%Base%>%$$, 00044 or it can be $icode Base$$ for any $codei%AD<%Base%>%$$ type. 00045 00046 $head eps$$ 00047 The result $icode eps$$ has prototype 00048 $codei% 00049 %Float% eps 00050 %$$ 00051 00052 $end 00053 ------------------------------------------------------------------------------ 00054 */ 00055 00056 namespace CppAD { 00057 00058 template <class ADtype> 00059 inline ADtype epsilon(void) 00060 { typedef typename ADtype::value_type value_type; 00061 return ADtype ( epsilon<value_type>() ); 00062 } 00063 00064 } 00065 # endif