a_double_compare_xam.py#

View page source

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 )
#