anchor.diff:          match d with
           | D(_) -> D(0.)
           | DD(_,dt,di) when i = di -> dt
  -        | DD(_,dt,di) when i <> di -> D(0.)
  +        | DD(_,_,di) when i <> di -> D(0.)
       /// Get the primal and the first gradient component of `d`, as a tuple
       let inline tuple (d:D) =
           match d with
  
positive.code:                 | D(_), D(_) -> DD(p, t, i)
                  | D(_), DD(_,_,_) -> DD(p, t, i)
                  | DD(_,_,_), D(_) -> DD(p, t, i)
                  | DD(pp,pt,pi), DD(tp,tt,ti) when pi < ti -> DD(DD(pp,D 0.,ti), DD(tp,tt,ti), i)
                  | DD(pp,pt,pi), DD(tp,tt,ti) when pi = ti -> DD(DD(pp,pt,pi), DD(tp,tt,pi), i)
                  | DD(pp,pt,pi), DD(tp,tt,ti) when pi > ti -> DD(DD(pp,pt,pi), DD(tp,D 0.,pi), i)
      /// Make D, with primal value `p` and tangent value `t`. A new tag will be attached using the global tagger.
      let inline dualPT p t = dualIPT GlobalTagger.Next p t
      /// Make D, with primal tag `i` and primal value `p`, and tangent 1.
  
negative.code:         match d with
          | D(_) -> d
          | DD(dp,_,di) when i = di -> dp
          | DD(_,_,di) when i <> di -> d
      /// Get the tangent value of `d`
      let inline tangent (d:D) =
          match d with
  