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() :
     #
     import numpy
     import cppad_py
     ok = True
     a2 = cppad_py.a_double(2.0)
     a3 = cppad_py.a_double(3.0)
     # ---------------------------------------------------------------------
     ok = ok and a2   <  a3
     ok = ok and a2   <= a3
     ok = ok and a3 >  a2
     ok = ok and a3 >= a2
     ok = ok and a3 != a2
     ok = ok and a3 == a3
     #
     ok = ok and not (a2 >  a3)
     ok = ok and not (a2 >= a3)
     ok = ok and not (a2 == a3)
     # ---------------------------------------------------------------------
     ok = ok and a2   <  3.0
     ok = ok and a2   <= 3.0
     ok = ok and a3 >  2.0
     ok = ok and a3 >= 2.0
     ok = ok and a3 != 2.0
     ok = ok and a3 == 3.0
     #
     ok = ok and not (a2 >  3.0)
     ok = ok and not (a2 >= 3.0)
     ok = ok and not (a2 == 3.0)
     #
     return( ok )
#

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