$\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }$

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:
 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 AD of Base object). Thus it will not be recorded as part of an AD of Base 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       if( b )           y = cos(x);      else y = sin(x);  only the assignment y = cos(x) is recorded on the tape (if x is a parameter , nothing is recorded). The CompareChange function can yield some information about changes in comparison operation results. You can use CondExp to obtain comparison operations that depends on the 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
The file compare.cpp contains an example and test of these operations. It returns true if it succeeds and false otherwise.