C++: a_double Binary Operators With AD Result: Example and Test
# include <cstdio>
# include <string>
# include <cppad/swig/cppad_swig.hpp>
bool a_double_ad_binary_xam(void) {
using cppad_swig::a_double;
using cppad_swig::vec_bool;
using cppad_swig::vec_int;
using cppad_swig::vec_double;
using cppad_swig::vec_a_double;
using cppad_swig::a_fun;
using cppad_swig::sparse_rc;
using cppad_swig::sparse_rcv;
using cppad_swig::sparse_jac_work;
using cppad_swig::sparse_hes_work;
using std::string;
//// initialize return variable
bool ok = true;
//------------------------------------------------------------------------
a_double two = cppad_swig::a_double(2.0);
a_double three = cppad_swig::a_double(3.0);
//
a_double five = two + three;
a_double six = two * three;
a_double neg_one = two - three;
a_double two_thirds = two / three;
//
ok = ok && five.value() == 5.0;
ok = ok && six.value() == 6.0;
ok = ok && neg_one.value() == -1.0;
ok = ok && 0.5 < two_thirds.value();
ok = ok && two_thirds.value() < 1.0;
ok = ok && five < six;
//return( ok );
}