a_double_unary_op_xam.py#

View page source

Python: a_double Unary Plus and Minus: Example and Test#

def a_double_unary_op_xam() :
   #
   import numpy
   import cppad_py
   #
   # initialize return variable
   ok = True
   # ---------------------------------------------------------------------
   a2 = cppad_py.a_double(2.0)
   aplus2 = + a2
   a2_minus = - a2
   #
   ok = ok and aplus2 == 2.0
   ok = ok and a2_minus == -2.0
   #
   return( ok )
#