lines 9-141 of file: include/cppad/core/bool_fun.hpp

{xrst_begin bool_fun}

AD Boolean Functions
####################

Syntax
******

| ``CPPAD_BOOL_UNARY`` ( *Base* , *unary_name* )
| *b* = *unary_name* ( *u* )
| *b* = *unary_name* ( *x* )
| ``CPPAD_BOOL_BINARY`` ( *Base* , *binary_name* )
| *b* = *binary_name* ( *u* , *v* )

*b* = *binary_name* ( *x* , *y* )

Purpose
*******
Create a ``bool`` valued function that has ``AD`` < *Base* > arguments.

unary_name
**********
This is the name of the ``bool`` valued function with one argument
(as it is used in the source code).
The user must provide a version of *unary_name* where
the argument has type *Base* .
CppAD uses this to create a version of *unary_name* where the
argument has type ``AD`` < *Base* > .

u
*
The argument *u* has prototype

   ``const`` *Base* & *u*

It is the value at which the user provided version of *unary_name*
is to be evaluated.
It is also used for the first argument to the
user provided version of *binary_name* .

x
*
The argument *x* has prototype

   ``const AD`` < *Base* > & *x*

It is the value at which the CppAD provided version of *unary_name*
is to be evaluated.
It is also used for the first argument to the
CppAD provided version of *binary_name* .

b
*
The result *b* has prototype

   ``bool`` *b*

Create Unary
************
The preprocessor macro invocation

   ``CPPAD_BOOL_UNARY`` ( *Base* , *unary_name* )

defines the version of *unary_name* with a ``AD`` < *Base* >
argument.
This can with in a namespace
(not the ``CppAD`` namespace)
but must be outside of any routine.

binary_name
***********
This is the name of the ``bool`` valued function with two arguments
(as it is used in the source code).
The user must provide a version of *binary_name* where
the arguments have type *Base* .
CppAD uses this to create a version of *binary_name* where the
arguments have type ``AD`` < *Base* > .

v
*
The argument *v* has prototype

   ``const`` *Base* & *v*

It is the second argument to
the user provided version of *binary_name* .

y
*
The argument *x* has prototype

   ``const AD`` < *Base* > & *y*

It is the second argument to
the CppAD provided version of *binary_name* .

Create Binary
*************
The preprocessor macro invocation

   ``CPPAD_BOOL_BINARY`` ( *Base* , *binary_name* )

defines the version of *binary_name* with ``AD`` < *Base* >
arguments.
This can with in a namespace
(not the ``CppAD`` namespace)
but must be outside of any routine.

Operation Sequence
******************
The result of this operation is not an
:ref:`glossary@AD of Base` object.
Thus it will not be recorded as part of an
AD of *Base*
:ref:`operation sequence<glossary@Operation@Sequence>` .

Example
*******
{xrst_toc_hidden
   example/general/bool_fun.cpp
}
The file
:ref:`bool_fun.cpp-name`
contains an example and test of these operations.

Deprecated 2007-07-31
*********************
The preprocessor symbols ``CppADCreateUnaryBool``
and ``CppADCreateBinaryBool`` are defined to be the same as
``CPPAD_BOOL_UNARY`` and ``CPPAD_BOOL_BINARY`` respectively
(but their use is deprecated).

{xrst_end bool_fun}
