You can cut down on the overall number of function calls and multiplications like this:

```
T square_x(square(x.val_));
return fvar<T>(1 / sq_x, -2 * x.d_ / (sq_x * x.val_));
```

This is especially productive when T is a var or fvar, because then the multiplication op is even heavier.