00001 # ifndef CPPAD_DIV_EQ_INCLUDED
00002 # define CPPAD_DIV_EQ_INCLUDED
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 namespace CppAD {
00017 
00018 template <class Base>
00019 AD<Base>& AD<Base>::operator /= (const AD<Base> &right)
00020 {       Base left;
00021 
00022         left   = value_;
00023         value_ /= right.value_;
00024 
00025         if( Parameter(*this) )
00026         {       if( Variable(right) )
00027                 {       if( ! IdenticalZero(left) )
00028                         {       right.tape_this()->RecordOp(DivpvOp, 
00029                                         *this, left, right.taddr_
00030                                 );
00031                         }
00032                 }
00033         }
00034         else if( Parameter(right) )
00035         {       if( ! IdenticalOne(right.value_) )
00036                 {       tape_this()->RecordOp(DivvpOp, 
00037                                 *this, taddr_, right.value_
00038                         );
00039                 }
00040         }
00041         else
00042         {       CPPAD_ASSERT_KNOWN(
00043                         id_ == right.id_,
00044                         "Dividing AD objects that are"
00045                         " variables on different tapes."
00046                 );
00047                 tape_this()->RecordOp(DivvvOp, 
00048                         *this, taddr_, right.taddr_
00049                 );
00050         }
00051         return *this;
00052 }
00053 
00054 CPPAD_FOLD_ASSIGNMENT_OPERATOR(/=)
00055 
00056 } 
00057 
00058 # endif