Prev Next a_double_unary_op_xam.cpp Headings

@(@\newcommand{\B}[1]{ {\bf #1} } \newcommand{\R}[1]{ {\rm #1} }@)@
C++: a_double Unary Plus and Minus: Example and Test
# include <cstdio>
# include <cppad/py/cppad_py.hpp>

bool a_double_unary_op_xam(void) {
     using cppad_py::a_double;
     //
     // initialize return variable
     bool ok = true;
     //------------------------------------------------------------------------
     a_double a2(2.0);
     a_double aplus2 = + a2 ;
     a_double aminus2 = - a2 ;
     //
     ok = ok && aplus2 == 2.0;
     ok = ok && aminus2 == -2.0;
     //
     return( ok );
}

Input File: lib/example/cplusplus/a_double_unary_op_xam.cpp