---------------------------------------------------- lines 10-108 of file: include/cppad/core/compare.hpp ---------------------------------------------------- {xrst_begin Compare} AD Binary Comparison Operators ############################## Syntax ****** | *b* = *x* *Op* *y* Purpose ******* Compares two operands where one of the operands is an ``AD`` < *Base* > object. The comparison has the same interpretation as for the *Base* type. Op ** The operator *Op* is one of the following: .. csv-table:: :widths: auto **Op**,**Meaning** ``<``,is *x* less than *y* ``<=``,is *x* less than or equal *y* ``>``,is *x* greater than *y* ``>=``,is *x* greater than or equal *y* ``==``,is *x* equal to *y* ``!=``,is *x* not equal to *y* x * The operand *x* has prototype ``const`` *Type* & *x* where *Type* is ``AD`` < *Base* > , *Base* , or ``int`` . y * The operand *y* has prototype ``const`` *Type* & *y* where *Type* is ``AD`` < *Base* > , *Base* , or ``int`` . b * The result *b* has type ``bool`` *b* Operation Sequence ****************** The result of this operation is a ``bool`` value (not an :ref:`glossary@AD of Base` object). Thus it will not be recorded as part of an AD of *Base* :ref:`operation sequence` . For example, suppose *x* and *y* are ``AD`` < *Base* > objects, the tape corresponding to ``AD`` < *Base* > is recording, *b* is true, and the subsequent code is | |tab| ``if`` ( *b* ) | |tab| |tab| *y* = ``cos`` ( *x* ); | |tab| ``else`` | |tab| |tab| *y* = ``sin`` ( *x* ); only the assignment *y* = ``cos`` ( *x* ) is recorded on the tape (if *x* is a :ref:`glossary@Parameter` , nothing is recorded). The :ref:`CompareChange-name` function can yield some information about changes in comparison operation results. You can use :ref:`CondExp-name` to obtain comparison operations that depends on the :ref:`glossary@Tape@Independent Variable` values with out re-taping the AD sequence of operations. Assumptions *********** If one of the *Op* operators listed above is used with an ``AD`` < *Base* > object, it is assumed that the same operator is supported by the base type *Base* . Example ******* {xrst_toc_hidden example/general/compare.cpp } The file :ref:`compare.cpp-name` contains an example and test of these operations. {xrst_end Compare}