$\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}} }$
AD Compound Assignment Division: Example and Test

bool DivEq(void)
{     bool ok = true;
double eps99 = 99.0 * std::numeric_limits<double>::epsilon();

// domain space vector
size_t  n = 1;
double x0 = .5;
x[0]      = x0;

// declare independent variables and start tape recording

// range space vector
size_t m = 2;
y[0] = x[0] * x[0];  // initial value
y[0] /= 2;           // AD<double> /= int
y[0] /= 4.;          // AD<double> /= double
y[1] = y[0] /= x[0]; // use the result of a compound assignment

// create f: x -> y and stop tape recording

// check value
ok &= NearEqual(y[0] , x0*x0/(2.*4.*x0), eps99, eps99);
ok &= NearEqual(y[1] ,             y[0], eps99, eps99);

// forward computation of partials w.r.t. x[0]
dx[0] = 1.;
dy    = f.Forward(1, dx);
ok   &= NearEqual(dy[0], 1./8., eps99, eps99);
ok   &= NearEqual(dy[1], 1./8., eps99, eps99);

// reverse computation of derivative of y[0]
w[0]  = 1.;
w[1]  = 0.;
dw    = f.Reverse(1, w);
ok   &= NearEqual(dw[0], 1./8., eps99, eps99);

// use a VecAD<Base>::reference object with computed division