Prev Next a_double_compare_xam.py Headings

@(@\newcommand{\B}[1]{ {\bf #1} } \newcommand{\R}[1]{ {\rm #1} }@)@
Python: a_double Comparison Operators: Example and Test
def a_double_compare_xam() :
     #
     # load the Cppad Swig library
     import py_cppad
     #
     # initialize return variable
     ok = True
     # ---------------------------------------------------------------------
     two = py_cppad.a_double(2.0)
     three = py_cppad.a_double(3.0)
     #
     ok = ok and two   <  three
     ok = ok and two   <= three
     ok = ok and three >  two
     ok = ok and three >= two
     ok = ok and three != two
     ok = ok and three == three
     #
     ok = ok and not (two >  three) 
     ok = ok and not (two >= three) 
     ok = ok and not (two == three) 
     #
     return( ok )
#

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