Prev Next a_double_unary_op_xam.py Headings

@(@\newcommand{\B}[1]{ {\bf #1} } \newcommand{\R}[1]{ {\rm #1} }@)@
Python: a_double Unary Plus and Minus: Example and Test
# This test fails in Octave and so is skipped by make check_lib_octave
def a_double_unary_op_xam() :
     #
     # load the Cppad Swig library
     import py_cppad
     #
     # initialize return variable
     ok = True
     # ---------------------------------------------------------------------
     two = py_cppad.a_double(2.0)
     plus_two = + two 
     minus_two = - two 
     #
     ok = ok and plus_two.value() == 2.0
     ok = ok and minus_two.value() == -2.0
     #
     return( ok )
#

Input File: build/lib/example/python/a_double_unary_op_xam.py